#abc360f. F - InterSections
F - InterSections
Score : points
问题陈述
给定 个编号为 到 的区间。区间 是 。
如果两个区间 和 满足以下条件之一,则它们被认为相交: 或 。
定义 为与区间 相交的区间 的数量()。
在所有满足 的整数对 中,找到使 最大化的对 。如果有多个这样的对,选择 最小的对。如果还有多个对,选择它们中 最小的对。(由于 ,要回答的对 是唯一确定的。)
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given intervals numbered to . Interval is .
Two intervals and are said to intersect if and only if they satisfy either or .
Define as the number of intervals () that intersect with the interval .
Among all pairs of integers satisfying , find the pair that maximizes . If there are multiple such pairs, choose the one with the smallest . If there are still multiple pairs, choose the one with the smallest among them. (Since , the pair to be answered is uniquely determined.)
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the sought pair in the following format:
Sample Input 1
5
1 7
3 9
7 18
10 14
15 20
Sample Output 1
4 11
The maximum value of is , and among the pairs that achieve , the smallest is . The pairs that satisfy and are the following five:
Among these, the smallest is , so print and .
Sample Input 2
11
856977192 996441446
298251737 935869360
396653206 658841528
710569907 929136831
325371222 425309117
379628374 697340458
835681913 939343451
140179224 887672320
375607390 611397526
93530028 581033295
249611310 775998537
Sample Output 2
396653207 887672321