21 November 2004

srm 219 lessons

  • Do not hurry! Especially on the easy problem where you are tempted. In this SRM I have overlooked an overflow issue. Detecting it before starting to code would have probably took me 3-4minutes. I did not and the result was a delay of at least 15 minutes.
  • Have a good idea of how to treat special cases when you start coding. I had a O(2^N*N) solution to the medium problem but it had some off by one bugs related to whether people eat or not in the initial setting. Instead of taking a break and think about it I started doing more or less random changes because I had just a few more minutes. What a mistake! Think about it: even if you get lucky, would you feel good about yourself for not exactly knowing how you earned the points? [NOTE: the "normal" solution to this problem was O(2^N*N*N)]
  • Elegance should still be a foremost concern: don't be drawn to the "speed demons dark side". In the end you will see that elegance and speed go hand in hand. I'm particularily ashamed of my solution to the easy problem in this SRM.

No comments:

Post a Comment

Note: (1) You need to have third-party cookies enabled in order to comment on Blogger. (2) Better to copy your comment before hitting publish/preview. Blogger sometimes eats comments on the first try, but the second works. Crazy Blogger.