CF720F.Array Covering
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Misha has an array of integers of length n . He wants to choose k different continuous subarrays, so that each element of the array belongs to at least one of the chosen subarrays.
Misha wants to choose the subarrays in such a way that if he calculated the sum of elements for each subarray, and then add up all these sums, the resulting value was maximum possible.
输入格式
The first line of input contains two integers: n , k ( 1<=n<=100000 , 1<=k<=n⋅(n+1)/2 ) — the number of elements in the array and the number of different subarrays that must be chosen.
The second line contains n integers ai ( −50000<=ai<=50000 ) — the elements of the array.
输出格式
Output one integer — the maximum possible value Misha can get by choosing k different subarrays.
输入输出样例
输入#1
5 4 6 -4 -10 -4 7
输出#1
11