| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 (추가 시간 없음) | 256 MB | 136 | 80 | 71 | 59.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.
4 2 100 120 250 13
100 120 50 13
4 4 100 120 250 13
impossible
3 4 200 300 300
100 100 200
ICPC > Regionals > Europe > Central European Regional Contest > CERC 2021 연습 세션 Z번