結果

問題 No.1015 おつりは要らないです
ユーザー rulerruler
提出日時 2020-04-03 22:09:22
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 783 bytes
コンパイル時間 71 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 18,868 KB
最終ジャッジ日時 2023-09-16 02:03:09
合計ジャッジ時間 4,251 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,200 KB
testcase_01 AC 15 ms
7,820 KB
testcase_02 AC 15 ms
7,828 KB
testcase_03 AC 16 ms
8,104 KB
testcase_04 AC 15 ms
8,152 KB
testcase_05 AC 16 ms
8,280 KB
testcase_06 AC 16 ms
8,296 KB
testcase_07 AC 15 ms
7,816 KB
testcase_08 AC 15 ms
7,936 KB
testcase_09 AC 15 ms
7,824 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 110 ms
18,152 KB
testcase_16 AC 109 ms
18,480 KB
testcase_17 AC 112 ms
18,716 KB
testcase_18 AC 109 ms
18,516 KB
testcase_19 AC 107 ms
18,460 KB
testcase_20 AC 108 ms
18,712 KB
testcase_21 AC 101 ms
18,572 KB
testcase_22 AC 102 ms
18,700 KB
testcase_23 AC 99 ms
18,052 KB
testcase_24 AC 105 ms
18,716 KB
testcase_25 AC 101 ms
18,544 KB
testcase_26 AC 102 ms
18,536 KB
testcase_27 AC 101 ms
18,436 KB
testcase_28 AC 100 ms
18,536 KB
testcase_29 AC 102 ms
18,536 KB
testcase_30 AC 16 ms
7,796 KB
testcase_31 AC 55 ms
9,796 KB
testcase_32 AC 55 ms
9,824 KB
testcase_33 AC 49 ms
18,868 KB
testcase_34 AC 15 ms
8,196 KB
testcase_35 AC 15 ms
8,136 KB
testcase_36 AC 15 ms
8,208 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

n, x, y, z, *a = map(int, sys.stdin.read().split())

def use(cnt, val):
    for i in range(n):
        if a[i] < val:
            continue
        q, r = divmod(a[i], val)
        if cnt >= q:
            cnt -= q
            a[i] = r
        else:
            q -= cnt
            cnt = 0
            a[i] = val * q + r
            break
    else:
        a.sort(reverse=True)
        for i in range(n):
            if a[i] >= 0:
                if cnt:
                    a[i] = -1
                    cnt -= 1
                else:
                    break
            else:
                print('Yes')
                sys.exit()
            
def main():
    use(z, 10000)
    use(y, 5000)
    use(x, 1000)
    print('No')
    
if __name__ == '__main__':
    main()
0