結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
|
提出日時 | 2021-05-01 08:12:27 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 136 ms / 2,000 ms |
コード長 | 560 bytes |
コンパイル時間 | 336 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 103,424 KB |
最終ジャッジ日時 | 2024-07-19 11:10:39 |
合計ジャッジ時間 | 5,059 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
N,X,Y,Z=map(int, input().split()) A=list(map(int, input().split())) A.sort(reverse=True) B=[] for a in A: z=min(a//10000,Z) a-=z*10000 Z-=z if a>=0: B.append(a) A=B A.sort(reverse=True) B=[] for a in A: if Z>0: Z-=1 else: y=min(a//5000,Y) a-=y*5000 Y-=y if a>=0: B.append(a) A=B A.sort(reverse=True) B=[] for a in A: if Z>0: Z-=1 elif Y>0: Y-=1 else: x=a//1000+1 X-=x if X<0 or Y<0 or Z<0: print("No") exit() print("Yes")