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

26242번 - Karmon be ill 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB111100.000%

문제

Vasya loves catching karmons. Every karmon has a numerical parameterBP (battle power). The larger the parameter value, the stronger the karmon --- and the more valuable.

Vasya's feeling ill and he's asked his friend Peter to go karmon trapping instead of him. Peter has agreed, but Vasya also asked for another thing: he wants Peter to report the BP sum of the $K$ most powerful currently caught karmons every time Peter catches another karmon. Peter has found this request a bit weird, but there's nothing he wouldn't do for an ill friend. Nevertheless he decided to clarify things and asked Vasya what should be done if he hasn't yet collected $K$ karmons. Vasya gave it a thought and decided that in this case, Peter shouldn't report anything at all.

Help Peter write a program that is fed a list of BP's of the caught karmons and produces the values to be reported to Vasya.

입력

The first line contains two integers: $N$ --- the total number of the trapped karmons and $K$ --- the number of karmons for which the sum of their BP must be reported (10ドル \le N \le 100,000円,ドル 2ドル \le K \le \min(N, 1000)$).

The second line contains $N$ integers defining the karmons' BP in order of catching. All these numbers lie within the range of 1ドル$ to 10ドル,000円$ inclusively.

출력

The single line of the output file must contain $(N - K + 1)$ integers --- the sums of BP for the $K$ most powerful karmons after catching each karmon (beginning from the $K$-th one).

제한

예제 입력 1

14 4
1 2 3 4 5 6 7 8 9 10 1 1 1 1

예제 출력 1

10 14 18 22 26 30 34 34 34 34 34

힌트

출처

Contest > Open Cup > 2016/2017 Season > Stage 5: Grand Prix of Siberia 9번

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

출처

대학교 대회

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

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