![]() |
||||||||||
|
||||||||||
Hakase and NanoTime Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3196 Accepted Submission(s): 1195 Problem Description Hakase and Nano are playing an ancient pebble game (pebble is a kind of rock). There are n packs of pebbles, and the i-th pack contains ai pebbles. They take turns to pick up pebbles. In each turn, they can choose a pack arbitrarily and pick up at least one pebble in this pack. The person who takes the last pebble wins. This time, Hakase cheats. In each turn, she must pick pebbles following the rules twice continuously. Suppose both players play optimally, can you tell whether Hakase will win? Input The first line contains an integer $ T \left(1 \leq T \leq 20 \right) $ representing the number of test cases. For each test case, the first line of description contains two integers $ n \left(1 \leq n \leq 10^6 \right) $ and d ( d = 1 or d = 2 ) . If $ d = 1 $, Hakase takes first and if $ d = 2 $, Nano takes first. n represents the number of pebble packs. The second line contains n integers, the i-th integer $ a_{i} \left( 1 \leq a_{i} \leq 10^{9} \right) $ represents the number of pebbles in the i-th pebble pack. Output For each test case, print “Yes” or “No” in one line. If Hakase can win, print “Yes”, otherwise, print “No”. Sample Input
Sample Output
Source | ||||||||||
|