| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 2048 MB | 10 | 4 | 4 | 50.000% |
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.
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.
| 번호 | 배점 | 제한 |
|---|---|---|
| 1 | 10 | The sum of $N$ over all test cases is at most 10ドル^3,ドル and the sum of $Q$ over all test cases is at most 10ドル^3$. |
| 2 | 20 | $-1\le a_i\le 1$ for all $i,ドル and for any query of the first type, $-1\le x\le 1$. |
| 3 | 30 | 0ドル\le a_i\le 2$ for all $i,ドル and for any query of the first type, 0ドル\le x\le 2$. |
| 4 | 40 | No additional constraints. |
4 5 5 -1 2 0 -2 1 1 2 1 2 1 1 4 2 2 3 2 -2 4 3 -1 -1 -1 -1 1 4 1 2 -1 2 -4 6 6 1 -1 1 -1 1 -1 1 3 0 2 1 2 -2 2 3 1 3 2 2 1 6 3 0 0 0 0 0 0 2 2 1 1 1 2 1
YES 2 2 YES 3 5 NO YES 2 2 NO YES 1 1 YES 2 4 NO YES 1 1 NO YES 1 1
For the first test case:
For the second test case: