Problem 2585 --Distinct Values

2585: Distinct Values

"
Time Limit $2$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $3$ 正确数量 $1$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签
Chiaki has an array of n positive integers. You are told some facts about the array: for every two elements ai and aj in the subarray al..r (l≤i<j≤r), ai≠ajholds.
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≤n,m≤105) -- the length of the array and the number of facts. Each of the next m lines contains two integers li and ri (1≤li≤ri≤n).
It is guaranteed that neither the sum of all n nor the sum of all m exceeds 106.

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.
3
2 1
1 2
4 2
1 2
3 4
5 2
1 3
2 4
1 2
1 2 1 2
1 2 3 1 1

推荐代码 查看2585 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$464 $ms] 刘欢@计算机科学与技术161 269284 2018-08-07 21:28:14
内存最少[$3652 $KB] 刘欢@计算机科学与技术161 269284 2018-08-07 21:28:14
第一AC 刘欢@计算机科学与技术161 269284 2018-08-07 21:28:14
第一挑战 刘欢@计算机科学与技术161 269283 2018-08-07 21:24:32

赛题来源/所属竞赛 HDU N/A

竞赛编号 竞赛名称 竞赛时间 访问比赛