| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 1024 MB | 6 | 6 | 2 | 100.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$.
12 5 1 6 7 8 1 4 3 9 5 12
1 2 3 4 5 6 1 2 7 3 4 8