Logo
(追記) (追記ここまで)

23134번 - Interval Shuffle 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB37202060.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:

  1. Choose $x \in [L_i, R_i]$ and update $A_x := A_x + 1$.
  2. Rearrange $A_{L_i...R_i}$ in any order Kanade wants.

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.

제한

예제 입력 1

4 3
0 1 0 1
2 4
1 3
2 3

예제 출력 1

2 4 3 2

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2021 > Day 4: 2021 Shanghai ICPC Camp Onsite 1 by PKU F번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /