結果
| 問題 |
No.1015 おつりは要らないです
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-08 01:05:19 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 630 bytes |
| コンパイル時間 | 326 ms |
| コンパイル使用メモリ | 82,404 KB |
| 実行使用メモリ | 97,076 KB |
| 最終ジャッジ日時 | 2025-01-08 01:05:28 |
| 合計ジャッジ時間 | 7,045 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 WA * 7 |
ソースコード
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")