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

18980번 - Distinct Values 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB37211666.667%

문제

Chiaki has an array of $n$ positive integers. You are told some facts about the array: for every two elements $a_i$ and $a_j$ in the subarray $a_{l..r}$ ($l \le i < j \le r$), $a_i \ne a_j$ holds.

Chiaki would like to find a lexicographically minimal array which meets the facts.

입력

There are multiple test cases. The first line of input contains an integer $T,ドル indicating the number of test cases. For each test case:

The first line contains two integers $n$ and $m$ (1ドル \le n, m \le 10^5$) -- the length of the array and the number of facts. Each of the next $m$ lines contains two integers $l_i$ and $r_i$ (1ドル \le l_i \le r_i \le n$).

It is guaranteed that neither the sum of all $n$ nor the sum of all $m$ exceeds 10ドル^6$.

출력

For each test case, output $n$ integers denoting the lexicographically minimal array. Integers should be separated by a single space, and no extra spaces are allowed at the end of lines.

제한

예제 입력 1

3
2 1
1 2
4 2
1 2
3 4
5 2
1 3
2 4

예제 출력 1

1 2
1 2 1 2
1 2 3 1 1

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2018 > Day 4: Xi Lin Contest D번

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

출처

대학교 대회

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

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