← Back to topics
Topic

Palin

M
MilosRadic
hmm can someone check the test cases cause i get 2 wrong results but when i check them at home(from IOI official site) i get correct results:S
m
msantl
They're good.

http://www.z-trening.com/submit.php?subm_stat=1&submit=7100149602
M
MilosRadic
well i have asked aleksandar who has published this task and he says they are ok...i asked for 4th test case and when i run it on my comp it gave the correct result:S
m
msantl
Try to increase the size of the arrays.
M
MilosRadic
lol it worked:S
just why??
i dont get it on my comp it gave good result with the smaller array...
in this test n is 5000
so 5000 chars
it fits in a niz[5000]...
m
msantl
If you have a string "palin" in your array it would be "palin\0' so every time you need space for X characters you should reserve X + 1 places, this 1 is for the null character ( he defines the end of the string in array ). Your code probably didn't work here because the \0 was placed on the end and you lost the last character.
M
MilosRadic
hmm but there are 2 more test cases with maximum n bit still they passed
and also why does it work normally on my comp?
m
msantl
Maybe the last character wasn't important for the solution in those 2 TC. I don't know why it works on your pc but maybe the OS that you're using doesn't have the same memory management as the one on the graders.
M
MilosRadic
yea its probably cause of that:D
next time always increase the size of the array:D