AT_abc457_d.Raise Minimum

普及-

通过率:0%

时间限制:2.00s

内存限制:1024MB

AC君温馨提醒

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

题目描述

You are given a sequence A=(A1,A2,…,AN)A = (A_1, A_2, \ldots, A_N) of length NN and an integer KK.

You can perform the following operation between 00 and KK times, inclusive.

  • Choose an integer ii satisfying 1≤i≤N1 \le i \le N, and add ii to AiA_i.

Find the maximum possible value of min⁡1≤i≤NAi\displaystyle \min_{1 \le i \le N} A_i for the sequence after the operations.

给你一个长度为 NN 的序列 A=(A1,A2,…,AN)A = (A_1, A_2, \ldots, A_N) 和一个整数 KK。

你可以执行以下操作 00 至 KK 次(含端点):

  • 选择一个满足 1≤i≤N1 \le i \le N 的整数 ii,并将 ii 加到 AiA_i 上。

求经过上述操作后,序列中 min⁡1≤i≤NAi\displaystyle \min_{1 \le i \le N} A_i 的最大可能值。

输入格式

The input is given from Standard Input in the following format:

NN KK
A1A_1 A2A_2 …\ldots ANA_N

输入从标准输入中按以下格式给出:

NN KK
A1A_1 A2A_2 …\ldots ANA_N

输出格式

Output the answer.

输出答案。

输入输出样例

  • 输入#1

    3 3
    1 2 3

    输出#1

    3
  • 输入#2

    4 5
    10 1 10 1

    输出#2

    7
  • 输入#3

    20 457
    8 9 10 9 8 8 4 6 8 1 5 10 2 8 2 6 8 1 6 6

    输出#3

    132

说明/提示

Sample 1 Explanation:
For example, by choosing i=1i = 1 twice and i=2i = 2 once, the sequence becomes (3,4,3)(3, 4, 3). In this case, the minimum value is 33.

It is impossible to make the minimum value 44 or greater, so output 33.

Constraints

  • 1≤N≤2×1051 \le N \le 2 \times 10^5
  • 1≤Ai≤10181 \le A_i \le 10^{18}
  • 1≤K≤10181 \le K \le 10^{18}
  • All input values are integers.

样例 1 解释:
例如,选择 i=1i = 1 两次、i=2i = 2 一次,序列变为 (3,4,3)(3, 4, 3)。此时最小值为 33。

无法使最小值达到 44 或更大,因此输出 33。

限制条件

  • 1≤N≤2×1051 \le N \le 2 \times 10^5
  • 1≤Ai≤10181 \le A_i \le 10^{18}
  • 1≤K≤10181 \le K \le 10^{18}
  • 所有输入值均为整数。

输入解题思路,AI测评打分。不知道怎么写?

首页