結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
|
提出日時 | 2020-06-27 15:14:05 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 860 bytes |
コンパイル時間 | 119 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 21,604 KB |
最終ジャッジ日時 | 2024-07-05 09:12:14 |
合計ジャッジ時間 | 9,968 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 25 WA * 8 |
ソースコード
from heapq import heappop, heapify, heappush n, x, y, z = map(int, input().split()) A = list(int(-a) for a in map(int, input().split())) heapify(A) if n > x + y + z or -sum(A) >= x * 1000 + y * 5000 + z * 10000: print("No") exit() while A: if not z: break a = -heappop(A) if a >= 10000: use = min(a//10000, z) z -= use a -= use * 10000 heappush(A, -a) else: z = -1 while A: if not y: break a = -heappop(A) if a >= 5000: use = min(a//5000, y) y -= use a -= use * 5000 heappush(A, -a) else: y = -1 while A: if not x: break a = -heappop(A) if a >= 1000: use = min(a//1000, x) x -= use a -= use * 1000 heappush(A, -a) else: x = -1 print("No" if A else "Yes")