| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 256 MB | 37 | 20 | 20 | 60.606% |
Kanade has a sequence $A_{1...n}$ and $m$ intervals $[L_i, R_i]$ of indices from 1ドル$ to $n,ドル bounds included. He does $m$ operations in sequence, one for each interval. For the $i$-th operation, Kanade can choose and perform one of the following two actions:
Now Kanade wants to know the maximum value of $A_{k}$ after these operations. Find the answer for each $k \in [1, n]$.
The first line of input contains two integers $n$ and $m,ドル the size of the sequence and the number of operations (1ドル \leq n, m \leq 2 \cdot 10^5$). The second line contains $n$ integers $A_{1...n},ドル the initial sequence (0ドル \leq A_i \leq 2 \cdot 10^5$).
Then follow $m$ lines. The $i$-th of them contains two integers $L_i$ and $R_i$ describing the respective interval (1ドル \leq L_i \leq R_i \leq n$).
Output $n$ integers, the $i$-th of which is the maximum possible value of $A_{i}$ after $m$ operations.
4 3 0 1 0 1 2 4 1 3 2 3
2 4 3 2