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

25101번 - Robin Hood 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
3 초 (추가 시간 없음) 256 MB136807159.167%

문제

Elders of the village foresee a harsh winter and Robin Hood is worried about the wellbeing of those less well off. As usual, he will be doing a bit of wealth redistribution in the kingdom, that is, he plans to steal from the rich. He estimates that $K$ heists will be required. However, Robin Hood has a moral codex that determines who the best target is. He always steals from the richest person – if there are several, he will pick the first one on the list. He only steals 100ドル$ monetary units at the time and never steals from anybody who would be left with 0ドル$ (or less) money after the heist.

You are provided with the information about the wealth of $N$ men and the number of heists, denoted as $K$. Compute the amount of wealth left after $K$ performed heists according to the described moral codex.

입력

The first line contains two space-separated integers, $N$ and $K$. The second line contains $N$ space-separated integers $P_i,ドル the wealth of all Robin Hood’s targets.

출력

Print the amount of wealth after the $K$ thefts, or print impossible if Robin Hood cannot perform that many thefts.

제한

  • 1ドル ≤ N, K ≤ 10^5$
  • 1ドル ≤ P_i ≤ 10^9$

예제 입력 1

4 2
100 120 250 13

예제 출력 1

100 120 50 13

예제 입력 2

4 4
100 120 250 13

예제 출력 2

impossible

예제 입력 3

3 4
200 300 300

예제 출력 3

100 100 200

힌트

출처

ICPC > Regionals > Europe > Central European Regional Contest > CERC 2021 연습 세션 Z번

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

출처

대학교 대회

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

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