Hello, I was recently solving this problem : http://codeforces.net/contest/35/problem/E
My solution uses line sweep here : http://codeforces.net/contest/35/submission/27660692
It gets MLE on the first sample test case + 1200+MS. Now when I run this on custom invocation without reading/writing into file I get :
Used: 15 ms, 4 KB
Is it possible to get past this MLE ? Can someone explain what is going on?
Thanks !
Note that the problem statement asks you to read from file and output to a file. You don't do that in the very first lines of the code — you read
n
from the standard input.scanf
fails and behavior of any code afterwards which relies onn
is undefined. In particular, you've got MLE on this test case. Don't try to find logic here — it's undefined behavior.Now that's another stupid mistake to add on my list..
Thank you for the help. AC now. :)