結果
問題 | No.1015 おつりは要らないです |
ユーザー | qumazaki |
提出日時 | 2020-09-09 01:03:52 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 61 ms / 2,000 ms |
コード長 | 1,119 bytes |
コンパイル時間 | 144 ms |
コンパイル使用メモリ | 82,172 KB |
実行使用メモリ | 85,888 KB |
最終ジャッジ日時 | 2024-04-29 06:19:24 |
合計ジャッジ時間 | 2,955 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
53,576 KB |
testcase_01 | AC | 30 ms
52,620 KB |
testcase_02 | AC | 30 ms
52,816 KB |
testcase_03 | AC | 31 ms
52,896 KB |
testcase_04 | AC | 33 ms
53,184 KB |
testcase_05 | AC | 34 ms
53,100 KB |
testcase_06 | AC | 32 ms
52,772 KB |
testcase_07 | AC | 31 ms
53,216 KB |
testcase_08 | AC | 31 ms
54,240 KB |
testcase_09 | AC | 30 ms
53,244 KB |
testcase_10 | AC | 54 ms
83,848 KB |
testcase_11 | AC | 54 ms
83,784 KB |
testcase_12 | AC | 57 ms
83,332 KB |
testcase_13 | AC | 61 ms
84,516 KB |
testcase_14 | AC | 56 ms
83,620 KB |
testcase_15 | AC | 54 ms
82,820 KB |
testcase_16 | AC | 55 ms
84,588 KB |
testcase_17 | AC | 56 ms
84,940 KB |
testcase_18 | AC | 55 ms
83,364 KB |
testcase_19 | AC | 55 ms
84,292 KB |
testcase_20 | AC | 56 ms
83,660 KB |
testcase_21 | AC | 58 ms
82,720 KB |
testcase_22 | AC | 56 ms
82,804 KB |
testcase_23 | AC | 55 ms
82,596 KB |
testcase_24 | AC | 56 ms
84,500 KB |
testcase_25 | AC | 60 ms
83,568 KB |
testcase_26 | AC | 59 ms
82,628 KB |
testcase_27 | AC | 57 ms
83,508 KB |
testcase_28 | AC | 56 ms
82,424 KB |
testcase_29 | AC | 55 ms
84,392 KB |
testcase_30 | AC | 32 ms
52,948 KB |
testcase_31 | AC | 50 ms
78,180 KB |
testcase_32 | AC | 51 ms
78,560 KB |
testcase_33 | AC | 57 ms
85,888 KB |
testcase_34 | AC | 32 ms
52,708 KB |
testcase_35 | AC | 32 ms
52,824 KB |
testcase_36 | AC | 31 ms
52,744 KB |
ソースコード
n,x,y,z = map(int,input().split()) a = list(map(int,input().split())) cnt_10000 = 0 rem = [0]*10 for i in range(n): cnt_10000 += a[i]//10000 a[i] %= 10000 rem[a[i]//1000] += 1 if(cnt_10000 <= z): z -= cnt_10000 cnt_10000 = 0 else: cnt_10000 -= z z = 0 cnt_10000 *= 10 if(cnt_10000 <= y*5): y -= cnt_10000//5 cnt_10000 = 0 else: cnt_10000 -= y*5 y = 0 if(cnt_10000 <= x): x -= cnt_10000 cnt_10000 = 0 else: print('No') exit() if(sum(rem) <= z): print('Yes') exit() for i in range(9,-1,-1): if(rem[i] >= z): rem[i] -= z z = 0 break z -= rem[i] rem[i] = 0 for i in range(9,4,-1): if(rem[i] >= y): rem[i-5] += y rem[i] -= y y = 0 break rem[i-5] += rem[i] y -= rem[i] rem[i] = 0 if(sum(rem) <= y): print('Yes') exit() for i in range(4,-1,-1): if(rem[i] >= y): rem[i] -= y y = 0 break y -= rem[i] rem[i] = 0 need = 0 for i,ri in enumerate(rem,1): need += ri*i if(need <= x): print('Yes') else: print('No')