Wednesday, August 26, 2009

Topcoder | SRM 447 experience





Hi all,


Again a very interesting experience.

The most amazing thing was that the count of contestants from Pakistan in this SRM was just ‘One’ and the reason was so obvious that it was at 7:00 AM and most of the contestants from Pakistan would have been sleeping at that time after having Saheri :)


The SRM was special in this sense because it was sponsored by facebook and top 3 positions of a room in DIV I and top 2 positions in DIV II got the prize money.


This time, again, I managed to solve only two problems.


The first problem was a bit simple. See the problem statement:

This simple problem took me 10 minutes to solve and the problem was lack of practice. There were two possible solutions for this problem:

  1. Sort both arrays in descending order and get the first ever value from “computers” that is greater than or equal to the current value of “complexity”. It can be done in just one loop iteration. See the code.
  2. Don’t sort the array and just solve it using nested loop. This strategy was a dirty one and I did this :P. See the code


The code for 500 pointer was a bit simple. Just do it as it is given in the problem statement. My code is here, let us see whether some better suggestions are there or not. Looking for comments


Oh! The code is here.


In challenge phase I didn’t participated because I was 3rd after coding phase in my room and there was a chance that after System Tests, I would have been managed to go to 2nd and qualify for the prize money, so same thing happened Al-hamdulillah and I finished at 2nd.

No comments:

Post a Comment