I've read this following solution from USACO for "IOI98 - Party Lamps"
problem..but I don't know why 2^4 and I don't know why the complete
search works for this problem...!!!
I didn't get exactly what it say...
Can anybody help me to understand it?

Thanks...



IOI 98 - Party Lamps:

http://olympiads.win.tue.nl/ioi/ioi98/contest/day1/party/party.html


USACO solution with compelete search:

You are given N lamps and four switches. The first switch toggles all
lamps, the second the even lamps, the third the odd lamps, and last
switch toggles lamps 1, 4, 7, 10, ... .
Given the number of lamps, N, the number of button presses made (up to
10,000), and the state of some of the lamps (e.g., lamp 7 is off),
output all the possible states the lamps could be in.
Naively, for each button press, you have to try 4 possibilities, for a
total of 410000 (about 106020 ), which means there's no way you could
do complete search (this particular algorithm would exploit
recursion).
Noticing that the order of the button presses does not matter gets
this number down to about 100004 (about 1016 ), still too big to
completely search (but certainly closer by a factor of over 106000 ).
However, pressing a button twice is the same as pressing the button no
times, so all you really have to check is pressing each button either
0 or 1 times. That's only 24 = 16 possibilities, surely a number of
iterations solvable within the time limit.

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to