CF863E Turn Off The TV
题目描述
Luba 有 $n$ 台电视,并且她知道每台电视的工作时间是从 $l$ 到 $r$。现在 Luba 想要关掉一些电视,使得播放电视节目的时间点不少于关掉这些电视之前。请你帮助 Luba,告诉她可以关闭哪些电视,若任何一台都不能关闭,输出 `-1`。
输入格式
第一行一个整数 $n$($1\le n\le 200000$),表示电视台的数量。
接下来 $n$ 行每行两个整数 $l_i,r_i$($0\leq l_i \leq r_i\leq 10 ^ 9$),表示第 $i$ 台电视工作的时间。
输出格式
若不能关闭任何一台电视,输出 `-1`,否则,输出任何一台可以关闭的电视的编号(编号在 $1\sim n$ 之间)。
感谢 @[凌幽](/user/36080) 提供的翻译。
fixed by 月。
说明/提示
Consider the first sample. Initially all integer moments of time such that at least one TV set is working are from the segment $ [1;7] $ . It's easy to see that this segment won't change if we switch off the first TV set (or the second one).
Note that in the fourth sample you can switch off the second TV set, since even without it all integer moments such that any of the TV sets is working denote the segment $ [1;4] $ .