305744: CF1084B. Kvass and the Fair Nut
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Kvass and the Fair Nut
题意翻译
$\ \ \ $小FN很喜欢喝kvass(某饮料)。一天他的爸爸妈妈伐他买了 $n$ 桶kvass,第 $i$ 个桶中装有 $v_i$ 升kvass。 现在小FN有一个容积为 $s$ 升的空杯子,他想用这些Kvass去填满他的杯子。他每次可以选择任意一个桶,向他的杯子中倒入正整数升的kvass。 $\ \ \ $小FN想知道,在他的杯子被装满后,所有桶中装kvass**最少**的那个桶,所装的kvass的升数的**最大值**。如果无论如何都无法装满他的杯子,输出 $-1$ 数据范围:所有输入数据均为正整数 $1\leq n\leq 1000$ $1\leq s\leq 10^{12}$ $1\leq v_i\leq 10^9$题目描述
The Fair Nut likes kvass very much. On his birthday parents presented him $ n $ kegs of kvass. There are $ v_i $ liters of kvass in the $ i $ -th keg. Each keg has a lever. You can pour your glass by exactly $ 1 $ liter pulling this lever. The Fair Nut likes this drink very much, so he wants to pour his glass by $ s $ liters of kvass. But he wants to do it, so kvass level in the least keg is as much as possible. Help him find out how much kvass can be in the least keg or define it's not possible to pour his glass by $ s $ liters of kvass.输入输出格式
输入格式
The first line contains two integers $ n $ and $ s $ ( $ 1 \le n \le 10^3 $ , $ 1 \le s \le 10^{12} $ ) — the number of kegs and glass volume. The second line contains $ n $ integers $ v_1, v_2, \ldots, v_n $ ( $ 1 \le v_i \le 10^9 $ ) — the volume of $ i $ -th keg.
输出格式
If the Fair Nut cannot pour his glass by $ s $ liters of kvass, print $ -1 $ . Otherwise, print a single integer — how much kvass in the least keg can be.
输入输出样例
输入样例 #1
3 3
4 3 5
输出样例 #1
3
输入样例 #2
3 4
5 3 4
输出样例 #2
2
输入样例 #3
3 7
1 2 3
输出样例 #3
-1