#P7977. 「Stoi2033」世界未末日

「Stoi2033」世界未末日

Description

Vinsta and Stella have nn piles of stones. The ii-th pile has sis_i stones.

They agree to take turns starting from Vinsta. In each move, they may choose at least 11 pile and at most kk piles of stones to operate on. For the ii-th pile, they may choose two real numbers a,ba, b satisfying:

  • a×b=sia \times b = s_i
  • a+b=ca + b = c, where c[1,si]Zc \in [1, s_i] \cap \Z

Then they discard cc stones from the ii-th pile, i.e. set sisics_i \leftarrow s_i - c. The player who cannot make a move loses. They want to know whether Vinsta has a winning strategy.

Input Format

The first line contains three positive integers n,k,Sn, k, S, where S=max{si}S = \max\{s_i\}.

The second line contains nn positive integers sis_i, which represent the initial number of stones in the ii-th pile.

Output Format

Output one line. If there is a winning strategy, output YES; otherwise output NO.

7 1 13
2 3 4 5 7 10 11

YES

8 1 13
2 3 4 5 7 10 11 13

NO

7 2 100
19 26 8 17 11 45 14

YES

Hint

Constraints

This problem uses bundled testdata.

Subtask 1n1 \le n \le 1S1 \le S \le Score
11 300300 300300 77
22 3×1073 \times 10^7 88
33 3×10103\times 10^{10} 1616
44 3×1063\times 10^6 33 33
55 3×1033 \times 10^3
66 3×1073 \times 10^7 1616
77 3×10103\times 10^{10} 4747

For 100%100\% of the data, 1kn3×1061 \le k \le n \le 3 \times 10^6, and 1S3×10101 \le S \le 3 \times 10^{10}.

Translated by ChatGPT 5