#P1702. 突击考试
突击考试
Description
One day, the teacher decides to hold a surprise exam. It is known that each student has an ability level. There are desks in the classroom, arranged in a single row. Each desk can seat two students; the two students at desk have ability levels and . The teacher now decides to test people whose ability level is . He will choose consecutive desks from these desks for the exam, requiring that each of these desks has at least one person whose ability level is . We want to determine the maximum possible and the corresponding .
Input Format
Line 1: an integer .
Lines 2 to : each line contains two integers, and .
Output Format
Output two integers and , where is maximized; among those, choose the smallest possible .
3
3 5
4 5
1 3
2 5
Hint
Constraints
For all testdata, , .
Translated by ChatGPT 5
京公网安备 11011102002149号