Logo
(追記) (追記ここまで)

16254번 - Array Covering 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 512 MB47171338.235%

문제

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 ≤ 100 000, 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 ( -50 000 ≤ ai ≤ 50 000) — 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

힌트

출처

Contest > Russian Code Cup > 2016 > RCC 2016 Final Round F번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /