結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
|
提出日時 | 2025-01-08 00:53:15 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 632 bytes |
コンパイル時間 | 1,084 ms |
コンパイル使用メモリ | 81,664 KB |
実行使用メモリ | 97,228 KB |
最終ジャッジ日時 | 2025-01-08 00:53:26 |
合計ジャッジ時間 | 10,054 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 WA * 18 |
ソースコード
import heapq N,X,Y,Z=map(int,input().split()) A=list(map(int,input().split())) q=[] heapq.heapify(q) for i in range(N): heapq.heappush(q,-A[i]) while q and Z: n=-heapq.heappop(q) if n>=10000: Z-=n//10000 if Z<0: n+=-Z*10000 Z=0 n//=10000 heapq.heappush(q,-n) else: n-=10000 Z-=1 while q and Y: n=-heapq.heappop(q) if n>=5000: Y-=n//5000 if Y<0: n+=-Y*5000 Y=0 n//=5000 heapq.heappush(q,-n) else: n-=5000 Y-=1 while q: n=-heapq.heappop(q) X-=n//1000 n//=1000 if n==0: X-=1 if X>-1 and Y>-1 and Z>-1: print("Yes") else: print("No")