AT_abc457_d.Raise Minimum
普及-
通过率:0%
时间限制:2.00s
内存限制:1024MB
AC君温馨提醒
该题目为【atcoder】题库的题目,您提交的代码将被提交至atcoder进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a sequence A=(A1,A2,…,AN) of length N and an integer K.
You can perform the following operation between 0 and K times, inclusive.
- Choose an integer i satisfying 1≤i≤N, and add i to Ai.
Find the maximum possible value of 1≤i≤NminAi for the sequence after the operations.
给你一个长度为 N 的序列 A=(A1,A2,…,AN) 和一个整数 K。
你可以执行以下操作 0 至 K 次(含端点):
- 选择一个满足 1≤i≤N 的整数 i,并将 i 加到 Ai 上。
求经过上述操作后,序列中 1≤i≤NminAi 的最大可能值。
输入格式
The input is given from Standard Input in the following format:
N K
A1 A2 … AN
输入从标准输入中按以下格式给出:
N K
A1 A2 … AN
输出格式
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=1 twice and i=2 once, the sequence becomes (3,4,3). In this case, the minimum value is 3.
It is impossible to make the minimum value 4 or greater, so output 3.
Constraints
- 1≤N≤2×105
- 1≤Ai≤1018
- 1≤K≤1018
- All input values are integers.
样例 1 解释:
例如,选择 i=1 两次、i=2 一次,序列变为 (3,4,3)。此时最小值为 3。
无法使最小值达到 4 或更大,因此输出 3。
限制条件
- 1≤N≤2×105
- 1≤Ai≤1018
- 1≤K≤1018
- 所有输入值均为整数。
输入解题思路,AI测评打分。不知道怎么写?