304530: CF863E. Turn Off The TV
Memory Limit:256 MB
Time Limit:2 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Turn Off The TV
题意翻译
题意: Luba有n台电视,并且她知道每台电视的工作时间是从l到r.现在Luba想要关掉一些电视,使得播放电视节目的时间点不少于关掉这些电视之前.请你帮助Luba,告诉她可以关闭哪些电视,若任何一台都不能关闭,输出-1 输入: 第一行一个整数n(1<=n<=200000),表示电视台的数量 接下来n行每行两个整数li,ri,表示第i台电视工作的时间(0<=li,ri<=10^9) 输出: 若不能关闭任何一台电视,输出-1,否则,输出任何一台可以关闭的电视的编号(编号在1~n之间) 感谢@凌幽 提供的翻译题目描述
Luba needs your help again! Luba has $ n $ TV sets. She knows that $ i $ -th TV set will be working from moment of time $ l_{i} $ till moment $ r_{i} $ , inclusive. Luba wants to switch off one of TV sets in order to free the socket. Let's call some TV set redundant if after switching it off the number of integer moments of time when at least one of TV sets is working won't decrease. Luba will be very upset if she has to switch off a non-redundant TV set. Help Luba by telling her the index of some redundant TV set. If there is no any, print -1.输入输出格式
输入格式
The first line contains one integer number $ n (1<=n<=2·10^{5}) $ — the number of TV sets. Then $ n $ lines follow, each of them containing two integer numbers $ l_{i},r_{i} (0<=l_{i}<=r_{i}<=10^{9}) $ denoting the working time of $ i $ -th TV set.
输出格式
If there is no any redundant TV set, print -1. Otherwise print the index of any redundant TV set (TV sets are indexed from 1 to $ n $ ). If there are multiple answers, print any of them.
输入输出样例
输入样例 #1
3
1 3
4 6
1 7
输出样例 #1
1
输入样例 #2
2
0 10
0 10
输出样例 #2
1
输入样例 #3
3
1 2
3 4
6 8
输出样例 #3
-1
输入样例 #4
3
1 2
2 3
3 4
输出样例 #4
2