#abc348c. C - Colorful Beans
C - Colorful Beans
Score: points
问题陈述
有 种类型的豆子,每种类型一个豆子。第 种类型的豆子美味度为 ,颜色为 。豆子被混合在一起,只能通过颜色来区分。
你将选择一种颜色的豆子并吃下一个该颜色的豆子。通过选择最优颜色,最大化你所吃豆子的最小可能美味度。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
There are types of beans, one bean of each type. The -th type of bean has a deliciousness of and a color of . The beans are mixed and can only be distinguished by color.
You will choose one color of beans and eat one bean of that color. By selecting the optimal color, maximize the minimum possible deliciousness of the bean you eat.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print as an integer the maximum value of the minimum possible deliciousness of the bean you eat.
Sample Input 1
4
100 1
20 5
30 5
40 1
Sample Output 1
40
Note that beans of the same color cannot be distinguished from each other.
You can choose color or color .
- There are two types of beans of color , with deliciousness of and . Thus, the minimum deliciousness when choosing color is .
- There are two types of beans of color , with deliciousness of and . Thus, the minimum deliciousness when choosing color is .
To maximize the minimum deliciousness, you should choose color , so print the minimum deliciousness in that case: .
Sample Input 2
10
68 3
17 2
99 2
92 4
82 4
10 3
100 2
78 1
3 1
35 4
Sample Output 2
35