The writeup for this problem is in http://web.eecs.utk.edu/~jplank/topcoder-writeups/2010/ActivateGame/index.html.