luogu#P7979. 「Stoi2033」世界未末日 加强版
「Stoi2033」世界未末日 加强版
Background
Note: Using submission feedback to obtain testdata is cheating.
Even if the world is about to collapse
My dear, I will never shed a tear
I will not give up that feeling of having loved
Cherishing everything that remembers you
Even if the world is about to tilt
My dear, I will never say goodbye
Even if the doomsday threat is stronger than ever
With love, it is not tiring
—— "The World Has Not Ended Yet"
Problem Description
Vinsta and Stella have piles of stones, and the -th pile has stones.
They agree to take turns starting from Vinsta. In each move, one may choose at least pile and at most piles. For the -th pile, one may choose two real numbers such that:
Then discard stones from the -th pile, i.e., . The player who cannot make a move loses. They want to know whether Vinsta has a winning strategy.
Input Format
The first line contains a positive integer , the number of test cases.
Then follow test cases. For each test case, the first line contains three positive integers , where .
The second line contains positive integers , representing the initial number of stones in the -th pile.
Output Format
For each test case, output one line. If there is a winning strategy, output YES, otherwise output NO.
2
7 1 13
2 3 4 5 7 10 11
8 1 13
2 3 4 5 7 10 11 13
YES
NO
1
7 2 100
19 26 8 17 11 45 14
YES
Hint
For of the testdata, , , .
Translated by ChatGPT 5