Back to Problem Solutions forum
Hello! I made my program calculate the response in 9 seconds. For example input - in 7 ms. And with example I have a correct answer! But if I try with input data, it write me:
Expected answer was: Sorry, but checksum does not look correct :(
So I dont know, which answer should i get
I sure that my program is doing everything right
Hi Friend!
Sorry, I can't well debug your code myself (or rather I can but it will take bit too much time because this code is not split into small testable functions and has some bewildering style for me).
However, this line seems suspicious. What are these 7
and 8
? You should use substrings from the given point
till end, not truncating them just when you want.
I sure that my program is doing everything right
Hm... this is a bold statement :) Of course sometimes mistakes in the checker happen, but this one was solved by 40+ people... were they all wrong?
BTW solving it via TreeSet
looks like doing it wrong. I.e. you should get correct answer, but with waste tons
of memory and time. Though it may pass this specific test...
Hello Rodion!
I use only the first 7 characters of the string to sort the suffixes, remembering how long it was. This saves RAM. I can increase the length of the stored string, but the execution time and RAM size are increasing But I think this is not necessary, because sorting hardly needs more characters :)
"Hm... this is a bold statement :) Of course sometimes mistakes in the checker happen, but this one was solved by 40+ people... were they all wrong?" Of course, they were great and decided everything correctly, but most likely they used a different approach. I am sure that there are many different ways to solve :)
Okay. I solved this. I changed 7 to 40 :) My Code is working
I use only the first 7 characters of the string to sort the suffixes, remembering how long it was. This saves RAM
Honestly, this sounds quite funny. You make code which unnecessarily wastes tons of RAM and then tries hacking it to save RAM. Not that I'm criticising - just trying to explain why this approach looks awful and enraging... In case you show it to anyone... :)
_Okay. I solved this. I changed 7 to 40 :) My Code is working
Congratulations, not exactly "solved", rather "made it pass weak tests" :)
Though I think it would be better if you really solve the problem instead of adjusting incorrect/broken solution... But as we are not at job interview, you surely can leave it as is, ha-ha... Anyway you can return to it in future when you build more skill :)