結果
問題 |
No.156 キャンディー・ボックス
|
ユーザー |
![]() |
提出日時 | 2025-03-26 15:45:17 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,299 ms / 2,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 82,188 KB |
実行使用メモリ | 76,072 KB |
最終ジャッジ日時 | 2025-03-26 15:45:49 |
合計ジャッジ時間 | 5,908 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
ソースコード
N, M = map(int, input().split()) C = list(map(int, input().split())) current = C.copy() for _ in range(M): # Find all indices where current value is positive min_val = None min_idx = -1 for i in range(N): if current[i] > 0: if min_val is None or current[i] < min_val: min_val = current[i] min_idx = i if min_idx == -1: break # This should not happen as per problem constraints current[min_idx] -= 1 # Count the number of empty boxes print(sum(1 for x in current if x == 0))