This is gonna drive me crazy.
I made a checker program that verifies that:
- the output is a valid palindrome
- It is bigger than input
- There is no palindrome smaller than output and bigger than input
Then i also made a random number generator that outputs a test file containing a specified amount of test cases, each test cases being a random number string of random length up to 1000000 digits.
I tested like this :
ruby -e “puts (100000001); puts (0…10000000).to_a” | ./palin | ./checker 2> log.txt
and
./gen 10000000 | ./palin | ./checker 2> log.txt
And i didn’t get a single wrong output ! I spent a few hours verifying each and every part of my checker program and running tests, And i can’t find ONE test case that fucks up.
All this time i’m assuming there are NO leading zero in any input.
I’m gonna modify my program and my checker to handle leading zeros in different ways and try to submit, but i already did several tries like this.
Now what ?
Can someone who passed this problem send me his code so i can compare outputs before i go completely nuts ?
how about that as an input ?
ruby -e “puts (100000001); puts (0…10000000).to_a”
I’m currently running randomized tests (it’s been running for 3 hours now, and still no error found), but i can store the cases instead of testing them if needed.
i’ll push the checker on github if you want to test it.
edit:
palin.c has been modified to output the input as well, so the checker knows what its dealing with
edit: Well the smaller palindrome detection is bugged. I’ll fix that and run another series of tests
- should be fixed.
It generates an input for the palindrome program:
ruby -e “puts (100000001); puts (0…100000000).to_a” | ./palindrome
I’ll generate a test file and push it.
edit - Okay here goes:
A few special cases, then 50 randomly generated numbers or random length up to 1 billion digits.
I usually test with a lot more cases but then i gets too big to upload
There are no differences between my output and yours.
I don’t know what else to suggest. Perhaps an input file with all numbers between 0 and 10000 or something? Perhaps there’s another special case we’ve not thought of.
You don’t need to worry about leading zeros though, I used Assert statements to confirm that there aren’t any, nor any leading or trailing spaces.
Thanks for trying
The ruby script is there to test ALL numbers from x to y.
Here it tests all numbers from 0 to 100,000,000.
I already ran it and found no errors.
I also found a source code on the internet that passed the judge (tried it myself) and compared outputs with my program - no difference at all for numbers from 0 to 100,000,000, i stored their outputs in two files and used diff on them.
I’m not quite sure what to do next. I’m gonna try to contact the problem author and see if i can get the input used, i can’t think of anything else to do…
@vaishcr7, you mentioned in another thread that you’d got AC - did you find out what your problem was, or did you find a test case that gave you a clue?
Suggested Topics
Topic | Category | Replies | Views | Activity |
---|---|---|---|---|
Help me please! | ProblemSet Archive | 4 | 43 | 27d |
AIBOHPHOBIA - LPS vs Direct Approach | ProblemSet Archive | 1 | 123 | Mar 31 |
What am i Missing | ProblemSet Archive | 1 | 171 | Feb 22 |
Beangame | ProblemSet Archive | 2 | 136 | Apr 9 |
Getting TLE in AKBAR - Akbar , The great. Why? | ProblemSet Archive | 3 | 207 | Mar 11 |