google code jam frustration

i am so frustrated right now, i feel like yelling and screaming, etc, except that i can’t because mansoor’s asleep and the neighbors are too…

sooooo… something makes me decide to sign up for this google code jam 2004 competition… bad idea.

so it was 2 problems for the 1st round (i guess there was a challenge round or something too but i dunno, 2 problems basically, and you had an hour to do both of them).

really cool problems too mind you…. especially the second one. the first problem gave you a “map” consisting of you and enemy targets, and you had to return an array of the distances of the enemies to you.

the second problem was awesome – given a rock that drops in a pond of water, you always have this “ripple effect” – so given an array of such rocks, and assuming that ripple in any one spot is additive (and that the effect of a rock begins at time 0 as its weight and decreases as the time increases), what is the largest ripple value in a particular pond?

the first one took me a while even though it was easy, especially since i misread part of the problem and proceeded to waste about 15 minutes first trying to figure out how to get an ArrayList to sort in java, and then writing my own quick bubble sort algorithm when i didn’t have to.

the second problem (the big one, 1000 points) is what REALLY frustrated me. due to the great amount of time spent on the first problem, i had about 25 minutes to do this problem (minus however long it took me to read it and figure out what to do). if i had about 30 more seconds, i would have done it right… i found out my mistake 30 seconds after i submitted it – rather than do:

for (i=0; i<arr.length; i++)
   for(j=0; j<arr[i].length;j++)
      // code goes here

i instead did…

for (i=0; i<arr.length; i++)
   for (j=0; j<arr.length; j++)
       // code goes here

thus throwing all my answers off, thus kicking me out of the competition, thus making me uber frustrated because i knew how to do it and did it right even with the limited time remaining… it was just one silly error. the sad thing is, i found this same exact error three lines lower and i didn’t see this one three lines above until it was too late…

i guess i do admit it was pretty fun… but nonetheless, i am upset, and as thus, i am going to sleep now…

comments powered by Disqus