#Lutece1661. Playing With Stones
Playing With Stones
Migrated from Lutece 1661 Playing With Stones
All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.
Description
You and your friend are playing a game in which you and your friend take turns removing stones from piles. Initially there are piles with number of stones. On each turn, a player must remove at least one stone from one pile but no more than half of the number of stones in that pile. The player who cannot make any moves is considered lost. For example, if there are three piles with , and stones, then the player can take or stones from first pile, no stone from second pile, and only stone from third pile. Note that the player cannot take any stones from the second pile as is more than half of (the size of that pile). Assume that you and your friend play optimally and you play first, determine whether you have a winning move. You are said to have a winning move if after making that move, you can eventually win no matter what your friend does.
Input
The first line of input contains an integer denoting the number of testcases. Each testcase begins with an integer the number of piles. The next line contains integers the number of stones in each pile.
Output
For each testcase, print "YES
" (without quote) if you have a winning move, or "NO
" (without quote) if you don‟t have a winning move.
Samples
4
2
4 4
3
1 2 3
3
2 4 6
3
1 2 1
NO
YES
NO
YES
Resources
Indonesia > ACM-ICPC Regional Jakarta 2010 Problem C