CF830C.Bamboo Partition

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Vladimir wants to modernize partitions in his office. To make the office more comfortable he decided to remove a partition and plant several bamboos in a row. He thinks it would be nice if there are nn bamboos in a row, and the ii -th from the left is aia_{i} meters high.

Vladimir has just planted nn bamboos in a row, each of which has height 00 meters right now, but they grow 11 meter each day. In order to make the partition nice Vladimir can cut each bamboo once at any height (no greater that the height of the bamboo), and then the bamboo will stop growing.

Vladimir wants to check the bamboos each dd days (i.e. dd days after he planted, then after 2d2d days and so on), and cut the bamboos that reached the required height. Vladimir wants the total length of bamboo parts he will cut off to be no greater than kk meters.

What is the maximum value dd he can choose so that he can achieve what he wants without cutting off more than kk meters of bamboo?

输入格式

The first line contains two integers nn and kk ( 1<=n<=1001<=n<=100 , 1<=k<=10111<=k<=10^{11} ) — the number of bamboos and the maximum total length of cut parts, in meters.

The second line contains nn integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( 1<=ai<=1091<=a_{i}<=10^{9} ) — the required heights of bamboos, in meters.

输出格式

Print a single integer — the maximum value of dd such that Vladimir can reach his goal.

输入输出样例

  • 输入#1

    3 4
    1 3 5
    

    输出#1

    3
    
  • 输入#2

    3 40
    10 30 50
    

    输出#2

    32
    

说明/提示

In the first example Vladimir can check bamboos each 33 days. Then he will cut the first and the second bamboos after 33 days, and the third bamboo after 66 days. The total length of cut parts is 2+0+1=32+0+1=3 meters.

首页