#abc312c. C - Invisible Hand
C - Invisible Hand
Score : points
问题描述
在一个苹果市场中,有 个卖家和 个买家。
第 个卖家可以以不少于 日元的价格出售一个苹果(日元是日本的货币)。
第 个买家可以以不多于 日元的价格购买一个苹果。
找出满足以下条件的最小整数 。
条件:能够以 日元出售苹果的人数大于或等于能够以 日元购买苹果的人数。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are sellers and buyers in an apple market.
The -th seller may sell an apple for yen or more (yen is the currency in Japan).
The -th buyer may buy an apple for yen or less.
Find the minimum integer that satisfies the following condition.
Condition: The number of people who may sell an apple for yen is greater than or equal to the number of people who may buy an apple for yen.
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
3 4
110 90 120
100 80 120 10000
Sample Output 1
110
Two sellers, the -st and -nd, may sell an apple for yen; two buyers, the -rd and -th, may buy an apple for yen. Thus, satisfies the condition.
Since an integer less than does not satisfy the condition, this is the answer.
Sample Input 2
5 2
100000 100000 100000 100000 100000
100 200
Sample Output 2
201
Sample Input 3
3 2
100 100 100
80 120
Sample Output 3
100
update @ 2024/3/10 08:53:16