20 / 25
Aug 2019

Don’t worry about case like 04, 05 - leading zeros are disallowed. (I have vague memories of using asserts to test whether there are any leading zeros in the test data, and there aren’t.)

Did you correct:

2
97268987378
97268989378

updated the code for these cases both in even and odd length numbers. WA still. I can’t seem get past first test case itself. Shows running(1) and bang WA!

I get 97269096279 for both, i think that’s the good answer.
I can’t figure out a case where i’d get a wrong output…

That latest code is a step backwards. You need to retest with the test cases attached to your first post.

changed it back and added some more modifications . All previous test cases working( I hope) I tried most of them. Still WA. Any more I am missing.

That latest code passes all my test cases.

I am confused. Did you get AC or all the test cases that you could think of ?

This is why I hate ad hoc questions like these or greedy algorithms for the same reason. :slight_smile:

This is gonna drive me crazy.

I made a checker program that verifies that:

  1. the output is a valid palindrome
  2. It is bigger than input
  3. 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 ?

bro/lady we understand your frustation but this is not a social media platform where it’s alright to use cuss words. I am not offended but such behaviour needs to be nipped in the bud .
Also do share a test case if you find any which was causing wa in your code.

I’m curious as to what in what i wrote you consider a cuss word.

I’ll make sure to share if i find something.
In the meantime i can also send your code through my tests if you will.

“fucks” i am 100% sure that’s not a decent word even though we commonly use it. :slight_smile: Now let’s focus on getting an AC on this one.

I’m not going to share any code, but I’ll happily verify your test cases if you want. Either post your input here, or if it’s too big, PM me and I’ll share my email address.

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.

I didn’t particularly want to test your checker, but I was willing to test your input file if you have one, and compare your output with mine. I’ve no idea what to do with that Ruby, sorrry.

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?