結果
問題 | No.1015 おつりは要らないです |
ユーザー |
![]() |
提出日時 | 2020-04-04 00:22:49 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 103 ms / 2,000 ms |
コード長 | 1,152 bytes |
コンパイル時間 | 207 ms |
コンパイル使用メモリ | 82,292 KB |
実行使用メモリ | 93,200 KB |
最終ジャッジ日時 | 2024-11-17 23:19:25 |
合計ジャッジ時間 | 3,818 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
ソースコード
import sys sys.stdin.readline def I(): return int(input()) def MI(): return map(int, input().split()) def LI(): return list(map(int, input().split())) mod=10**9+7 def main(): N,X,Y,Z=MI() A=LI() L=[0]*N XX=0 YY=0 ZZ=0 for i in range(N): L[i]=(A[i]+1000)//1000 XX+=L[i] L.sort(reverse=True) for i in range(N): if L[i]>=10 and ZZ<Z: ch=min(L[i]//10,Z-ZZ) L[i]-=ch*10 XX-=ch*10 ZZ+=ch L.sort(reverse=True) for i in range(N): if ZZ<Z and L[i]<=10: XX-=(L[i]) L[i]=0 ZZ+=1 L.sort(reverse=True) for i in range(N): if L[i]>=5 and YY<Y: ch=min(L[i]//5,Y-YY) L[i]-=ch*5 XX-=ch*5 YY+=ch L.sort(reverse=True) for i in range(N): if YY<Y and L[i]<=5: XX-=(L[i]) L[i]=0 YY+=1 if XX<=X and YY<=Y and ZZ<=Z: print("Yes") else: print("No") main()