CF1027F.Session in BSU
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
The first line of the input contains one integer n ( 1≤n≤106 ) — the number of exams.
The next n lines contain two integers each: ai and bi ( 1≤ai<bi≤109 ), where ai is the number of day of the first passing the i -th exam and bi is the number of day of the second passing the i -th exam.
输入格式
If Polycarp cannot pass all the n exams, print -1. Otherwise print the minimum index of day by which Polycarp can do that.
输出格式
无
输入输出样例
输入#1
2 1 5 1 7
输出#1
5
输入#2
3 5 13 1 5 1 7
输出#2
7
输入#3
3 10 40 40 80 10 80
输出#3
80
输入#4
3 99 100 99 100 99 100
输出#4
-1