| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 2 초 | 512 MB | 55 | 31 | 19 | 47.500% |
Suppose we have an array $a$ whose elements are non-negative integers. We can apply operations of two types to this array:
After any operation, all the elements must remain non-negative.
It is easy to see that we cannot do such operations indefinitely. We'll call a chain of operations maximal if no valid operation can occur after performing this chain of operations.
Now you are given an array $b$ of length $n$. Your should handle two types of queries:
The first line of input contains one integer $n,ドル the length of array $b$ (1ドル \le n \le 2 \cdot 10^{5}$).
The second line contains $n$ integers separated by spaces: the initial elements of array $b$ (0ドル \le b_{i} \le 10^{5}$).
The third line contains one integer $q,ドル the number of queries (1ドル \le q \le 2 \cdot 10^{5}$).
Each of the next $q$ lines contains a query.
For queries of the first type, 1ドル \le p \le n$ and 0ドル \le x \le 10^{5}$.
For queries of the second type, 1ドル \le l \le r \le n$.
For each query of the second type, print the answer on a separate line. Answers should be printed in the same order as queries.
3 2 2 2 9 2 1 3 1 1 1 2 1 3 1 2 1 2 1 3 1 1 4 2 1 3 2 1 2 2 2 3
2 2 0 1 1 0
1 20500 1 2 1 1
0