2018 杭电多校1 - Distinct Values

【题目】

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 ≤ i < j ≤ r )$$$

input

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,m (1 ≤ n,m  ≤ 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 ≤ $$$l_i$$$ ≤ $$$r_i$$$  ≤ 10$$$^5$$$)

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

Sample Input

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

Sample Output

1 2

1 2 1 2

1 2 3 1 1

猜你喜欢

转载自www.cnblogs.com/tobyw/p/9358312.html