結果
問題 |
No.1015 おつりは要らないです
|
ユーザー |
![]() |
提出日時 | 2020-04-03 22:23:53 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,361 bytes |
コンパイル時間 | 227 ms |
コンパイル使用メモリ | 81,664 KB |
実行使用メモリ | 102,272 KB |
最終ジャッジ日時 | 2024-07-03 04:00:36 |
合計ジャッジ時間 | 6,075 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 WA * 17 TLE * 1 |
ソースコード
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 and man >= 1: res = min(man,i) man -= res i -= res if i > 0 and gosen >= 2: res = min(gosen,i*2) gosen -= res i -= res//2 if i > 0 and sen >= 10: res = min(sen,i*10) sen -= res i -= res//10 if i > 0: print("No") exit() #lst3の処理 #lst3が1000の場合、1000を支払えばよいが、1001の場合は2000必要 lst3.sort(reverse=True) thresh = 0 while man: man -= 1 thresh += 1 if thresh >= len(lst3): print("Yes") exit() lst3 = lst3[thresh:] for i in lst3: 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: 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")