| TeamsCode Summer 2026 Contest |
|---|
| Finished |
You are given an integer array $$$a$$$ of length $$$N$$$ and an integer $$$K$$$.
In one operation, you must pick two elements from $$$a$$$, remove them, and append their sum to $$$a$$$.
You have to make $$$Q$$$ of the following changes to the array: Given $$$i,j$$$, set $$$a_i$$$ to $$$j$$$.
After each change, output whether you can perform $$$ N-1$$$ operations without $$$a$$$ ever containing the value $$$K$$$, both before and after an operation.
The first line consists of an integer $$$t$$$ ($$$1 \le t \le 10^5$$$), the number of test cases.
The first line of each test case consists of three integers $$$N$$$ ($$$1 \le N \le 2 \cdot 10^5$$$), $$$K$$$ ($$$0 \le K \le 10^{12}$$$), and $$$Q$$$ ($$$1 \le Q \le 2 \cdot 10^5$$$).
The next line consists of $$$a_1, a_2, \dots ,a_n$$$ ($$$0 \le a_i \le 2 \cdot 10^5$$$).
The next $$$Q$$$ lines consist of two integers $$$i$$$ ($$$1 \le i \le N$$$), and $$$j$$$ ($$$0 \le j \le 2 \cdot 10^5$$$).
The sum of $$$N$$$ and the sum of $$$Q$$$ over all $$$t$$$ test cases does not exceed $$$2 \cdot 10^5$$$.
—
Tests in subtasks are numbered $$$1 - 20$$$ with samples skipped. Each test is worth $$$\frac{100}{20} = 5$$$ points.
Tests $$$1-2$$$ satisfy $$$N, a_i \le 5$$$.
Tests $$$3-5$$$ satisfy $$$N \le 10^4$$$.
Tests $$$6-20$$$ satisfy no additional constraints.
After each change, output "YES" if it is possible to perform exactly $$$N-1$$$ operations such that the array never contains the value $$$K$$$ at any point; otherwise, output "NO."
14 4 51 2 2 21 11 02 03 04 4
YESNONOYESNO
After change $$$1$$$, you can perform the operations $$$(1,2)$$$ to make $$$a=[2,2,3]$$$, $$$(2,3)$$$ to make $$$a=[2,5]$$$, and $$$(1,2)$$$ to make $$$a=[7]$$$.
After changes $$$2$$$ and $$$3$$$, there is no way to avoid $$$k=4$$$.
After change $$$4$$$, you can perform the operations $$$(1,2),(1,2),$$$ and $$$(1,2)$$$.
After change $$$5$$$, $$$k=4$$$ is already in $$$a$$$.
| Name |
|---|


