結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
![]() |
提出日時 | 2020-04-04 10:54:05 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,055 bytes |
コンパイル時間 | 136 ms |
コンパイル使用メモリ | 82,460 KB |
実行使用メモリ | 88,984 KB |
最終ジャッジ日時 | 2024-07-03 07:05:20 |
合計ジャッジ時間 | 3,936 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 WA * 18 |
ソースコード
n,z,y,x= map(int, input().split()) a= list(map(int, input().split())) a.sort(reverse=True) # 1万円以上のものには、1万円を割り当てる for i in range(n): if a[i]//10000>=1 and a[i]//10000<=x: x-=a[i]//10000 a[i]//=10000 elif a[i]//10000>x: a[i]-=10000*x x=0 break else: break a.sort(reverse=True) # 1万円を値段の高いもの順に割り当てる if x>0: # すでに1万円以上はない if n<=x: print('Yes') exit() else: del a[:x] # 5000円以上のものに50000円を割り当てる。 n1=len(a) for i in range(n1): if a[i]//5000==0: break elif a[i]//5000<=y: y-=a[i]//5000 a[i] //= 5000 else: break # すでに5000円以上はない if y>0: if n1<=y: print('Yes') exit() else: del a[:y] # 1000円以上のものに1000円を割り当てる n2=len(a) for i in range(n2): z-=a[i]//1000+1 if z>=0: print('Yes') else: print('No')