It was round 504. My first submission for problem D failed the pretests. I had 45 minutes to fix it. I figured out what was wrong with my approach fairly quickly but only found an alternate approach with roughly five minutes remaining in the contest. I coded as quickly as I could and submitted with 6 seconds to go in the contest. Unfortunately this solution also failed the pretests.
The reason my solution failed was I thought it would it be cool to write
for(int i=n-1; i; i--)
instead of
for(int i=n-1; i>=0; i--)
with the eventual goal of being a guy who writes stuff like
for(int i=n-1;i--;)
. Unfortunately
for(int i=n-1; i; i--)
terminates one step earlier than
for(int i=n-1; i>=0; i--)
, which is bad if you want to do stuff when i=0. So in conclusion it is probably not a good idea to experiment with new coding styles during a contest just because they look cool.