#P16250. [蓝桥杯 2026 省研究生组] 人类识别审查
[蓝桥杯 2026 省研究生组] 人类识别审查
Problem Description
In the year 2145, the world passed the "Synthetic Human Control Act". All suspected disguised high-bionic AI must undergo a "human identification review".
In the interrogation room of Xingang District, Xiaolan stared at the list projected on the table: there are a total of "agents" in the room, whose appearance and behavior are almost indistinguishable from humans. Some are real humans, and some are humanoid AI in disguise.
The review rules are as follows:
- Let the number of real humans in the room be ( is an integer satisfying ).
- The -th agent gives a testimony: "The number of humans is within the interval ."
- If an agent is a real human, then its testimony must be true, i.e., .
- If an agent is a disguised AI, then its testimony must be false, i.e., .
As Xiaolan's assistant, please analyze all testimonies and compute the maximum possible number of humans in the room (i.e., the largest possible value of ). If there is no logically consistent , output .
Input Format
The first line contains an integer , representing the number of agents in the room.
The next lines each contain two integers , representing the interval of the number of humans claimed by the -th agent.
Output Format
Output one integer, the maximum that satisfies the conditions; if there is no solution, output .
3
1 2
2 3
3 3
2
3
1 1
1 1
1 1
0
1
0 0
-1
Hint
【Constraints and Conventions】
For of the testdata, , .
For all testdata, , .
Translated by ChatGPT 5