| MITIT Winter 2025-26 Advanced Team Round |
|---|
| Закончено |
Busy Beaver has arranged $$$N$$$ logs in a line to form the base of his dam. Each log has an integer quality value between $$$-2$$$ and $$$2$$$. From time to time, some logs are replaced. He occasionally wants to know if there is a contiguous segment of logs whose total quality equals a given nonzero number $$$X$$$, and may also want to know the segment. Help Busy Beaver process all updates and queries efficiently.
The first line of input contains an integer $$$T$$$ ($$$1 \le T \le 10^4$$$) — the number of testcases.
The first line of each test case contains two integers $$$N$$$ and $$$Q$$$ ($$$1 \le N,Q \le 2\cdot 10^5$$$) — the size of the array and the number of queries, respectively.
The second line of each test case contains $$$N$$$ integers $$$a_1, a_2, \dots, a_N$$$ ($$$-2 \le a_i \le 2$$$) — the qualities of the logs.
The next $$$Q$$$ lines of each test case are of two forms:
There is at least one query of the second type.
The sum of $$$N$$$ over all test cases does not exceed $$$2\cdot 10^5$$$.
The sum of $$$Q$$$ over all test cases does not exceed $$$2\cdot 10^5$$$.
For each query of the second type, if a valid contiguous segment exists, print YES on the first line, followed by the left and right indices of that segment $$$l$$$ and $$$r$$$ on the next line ($$$1 \le l \le r \le N$$$). If no such segment exists, print NO on a single line.
You can output the answer in any case (upper or lower). For example, the strings "yEs", "yes", "Yes", and "YES" will be recognized as positive responses.
There are four subtasks in this problem. You can receive $$$50\%$$$ of the points for each subtask if the YES/NO answers are correct, but the indices are incorrect. To obtain these partial points, you must still output integers $$$l$$$ and $$$r$$$ between $$$1$$$ and $$$N$$$ after all YES answers.
45 5-1 2 0 -2 11 2 12 11 4 22 32 -24 3-1 -1 -1 -11 4 12 -12 -46 61 -1 1 -1 1 -11 3 02 12 -22 31 3 22 16 30 0 0 0 0 02 21 1 12 1
YES2 2YES3 5NOYES2 2NOYES1 1YES2 4NOYES1 1NOYES1 1
For the first test case:
For the second test case:
| Название |
|---|


