Thank you guys, it was indeed an int overflow caused by the multiplication :-)

Since it failed on the small Test set, I would have never thought of an 
overflow, but there was indeed no restriction on M, S an P on the Test set 1. I 
suspect the organisers to have done it on purpose so that you don't get your 
Test set 1 passing and your Test set 2 failing just because you didn't use long 
:-D

I didn't want my topic to be transformed into one of the many discussion about 
not showing the test data, but indeed here is one more example : I got "Wrong 
Answer" and spent a lot of time checking why my algorithm was wrong and 
imagining and testing a lot of edge cases. I would have never thought of an 
overflow if it wasn't for you.

My simple solution for the Test set 1 still didn't pass, I might create a new 
topic after some more investigation.

By not providing failed test cases / enough visible data, this forum will just 
get flooded by topics like "Why do I get Wrong Answer" for which the reason is 
quite stupid exactly like this topic.


-- 
You received this message because you are subscribed to the Google Groups 
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-code/ff79f307-652a-4dab-9bc9-71f04e1cc169%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to