I’m having the same problem. Can’t find a case where my program doesn’t work, still i’m getting WA.
I tried a few things on spojtoolkit/test/palin, which yield weird results :
04 becomes 05, as expected.
09 becomes 0, which is weird.
099 becomes 00, which isn’t any less weird.
So i tried to change my program to match this behavior, still WA.
I’m checking my output with cat -e to make sure I’m not displaying anything else than what i’m supposed to.
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.