I recently submitted a solution in C to the easy-level problem LECANDY. My execution time was 0.68 seconds.
On the right side of the problem page, the “successful submissions” panel showed that people had achieved an execution time of 0.02 seconds in C.
So I tried to optimize my IO (by using a custom integer-reading function which uses getchar_unlocked) and I reached an execution time of 0.12 s. I had no idea how I could improve my solution further. I viewed the solution submitted by someone else (who had an execution time of 0.02s) and I found out that my code was almost the same. There were minor differences like I used ‘unsigned int’ and the other user had used ‘int’. I copied the code of that person and submitted it as my own code. The execution time was again 0.12 s.
Why is it that exactly the same code is giving a huge difference in execution time when I’m the one submitting it?