結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,912 KB
testcase_01 AC 16 ms
8,088 KB
testcase_02 AC 17 ms
7,948 KB
testcase_03 AC 15 ms
7,912 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 16 ms
8,000 KB
testcase_08 AC 16 ms
8,012 KB
testcase_09 AC 16 ms
8,100 KB
testcase_10 AC 179 ms
18,544 KB
testcase_11 AC 188 ms
18,704 KB
testcase_12 AC 168 ms
18,072 KB
testcase_13 AC 178 ms
18,548 KB
testcase_14 AC 184 ms
18,848 KB
testcase_15 AC 174 ms
18,084 KB
testcase_16 AC 180 ms
18,668 KB
testcase_17 AC 182 ms
18,796 KB
testcase_18 AC 177 ms
18,612 KB
testcase_19 AC 174 ms
18,540 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 16 ms
7,996 KB
testcase_31 AC 133 ms
9,848 KB
testcase_32 AC 136 ms
9,964 KB
testcase_33 AC 65 ms
18,920 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 16 ms
8,012 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from bisect import bisect_left as bi_l, bisect_right as bi_r

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

def main():
    A.sort(reverse=True)
    r = [x, y, z]
    cand = [1000, 5000, 10000]
    for a in A:
        for i in range(2, -1, -1):
            q, p = divmod(a, cand[i])
            if r[i] >= q:
                r[i] -= q
                q = 0
            else:
                q -= r[i]
                r[i] = 0
            a = q * cand[i] + p
        i = bi_r(cand, a)
        while i < 3:
            if r[i] > 0:
                r[i] -= 1
                break
            else:
                i += 1
        else:
            print('No')
            return
    print('Yes')

if __name__ == '__main__':
    main()
0