結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
![]() |
提出日時 | 2020-04-03 22:01:41 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,386 bytes |
コンパイル時間 | 167 ms |
コンパイル使用メモリ | 82,316 KB |
実行使用メモリ | 99,072 KB |
最終ジャッジ日時 | 2024-07-03 02:46:07 |
合計ジャッジ時間 | 3,873 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 15 WA * 18 |
ソースコード
import sys readline = sys.stdin.buffer.readline def even(n): return 1 if n%2==0 else 0 n,sen,gosen,man = map(int,readline().split()) lst1 = list(map(int,readline().split())) lst2 = [] lst3 = [] for i in lst1: i = i+1 lst2.append(i//10000) lst3.append(i%10000) #lst2の処理 for i in lst2: if i == 0: continue if i > 0 and man >= 1: res = min(man,i) man -= res i -= res if i > 0 and gosen >= 1: res = min(gosen,i*2) gosen -= res i -= res if i > 0 and sen >= 1: res = min(sen,i*10) sen -= res i -= res if i > 0: print("No") exit() #lst3の処理 #lst3が1000の場合、1000を支払えばよいが、1001の場合は2000必要 lst3.sort(reverse=True) for i in lst3: if i > 0 and man >= 1: res = 1 man -= 1 i -= res*10000 if i >= 5000 and gosen >= 1: res = 1 gosen -= res i -= res*5000 if i > 0 and sen >= 1: for j in range(10): if i <= j*1000: res = j break if sen < res: print("No") exit() sen -= res i -= res*1000 if i > 0 and gosen >= 1: res = 1 gosen -= res i -= res*5000 if i > 0: print("No") exit() print("Yes")