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

29943번 - Programming Club 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB662100.000%

문제

School's programming club meets once a week and solves one problem every week. Problems are taken from a very thick and important book where they have been numbered starting from 1ドル$ and where there's an infinite number of problems. Every week the club members attending take the book, find the problem with the smallest number that none of them has solved yet, and solve it.

The club, however, has a problem with retaining its members. Each member $i$ starts attending on some week $l_i,ドル then attends every week until week $r_i,ドル but never comes back after that.

Determine which problem is solved every week.

입력

On the first line of input are two space-separated integers: number of weeks $N$ (1ドル \le N \le 10^5$) and number of club members $K$ (1ドル \le K \le 10^5$). Weeks are numbered 1ドル \ldots N$. On each of the following $K$ lines are two space-separated integers: the first week $l_i$ and the last week $r_i$ when when the member $i$ attends (1ドル \le l_i \le r_i \le N$). You can assume that every week at least one member attends the club.

출력

Write $N$ lines into output: the number of the problem solved during week $j$ onto line $j$.

제한

예제 입력 1

12 5
1 6
7 8
1 4
3 9
5 12

예제 출력 1

1
2
3
4
5
6
1
2
7
3
4
8

힌트

출처

Olympiad > Estonian Informatics Olympiad > 2018-19 > Preliminary Round 4번

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

출처

대학교 대회

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

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