結果

問題 No.1015 おつりは要らないです
ユーザー kimiyukikimiyuki
提出日時 2020-04-03 21:29:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 265 ms / 2,000 ms
コード長 929 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 22,264 KB
最終ジャッジ日時 2024-04-29 01:09:38
合計ジャッジ時間 6,571 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
11,520 KB
testcase_01 AC 41 ms
11,520 KB
testcase_02 AC 39 ms
11,264 KB
testcase_03 AC 35 ms
11,520 KB
testcase_04 AC 35 ms
11,392 KB
testcase_05 AC 36 ms
11,520 KB
testcase_06 AC 36 ms
11,392 KB
testcase_07 AC 36 ms
11,392 KB
testcase_08 AC 38 ms
11,392 KB
testcase_09 AC 37 ms
11,392 KB
testcase_10 AC 265 ms
22,000 KB
testcase_11 AC 243 ms
21,912 KB
testcase_12 AC 224 ms
21,632 KB
testcase_13 AC 237 ms
21,856 KB
testcase_14 AC 245 ms
22,188 KB
testcase_15 AC 230 ms
21,556 KB
testcase_16 AC 239 ms
21,868 KB
testcase_17 AC 241 ms
22,264 KB
testcase_18 AC 232 ms
21,828 KB
testcase_19 AC 246 ms
21,552 KB
testcase_20 AC 193 ms
21,932 KB
testcase_21 AC 174 ms
21,616 KB
testcase_22 AC 178 ms
21,740 KB
testcase_23 AC 169 ms
21,396 KB
testcase_24 AC 170 ms
21,760 KB
testcase_25 AC 172 ms
21,872 KB
testcase_26 AC 168 ms
21,596 KB
testcase_27 AC 175 ms
21,520 KB
testcase_28 AC 172 ms
21,492 KB
testcase_29 AC 178 ms
21,908 KB
testcase_30 AC 31 ms
11,392 KB
testcase_31 AC 141 ms
13,156 KB
testcase_32 AC 146 ms
13,408 KB
testcase_33 AC 183 ms
22,196 KB
testcase_34 AC 32 ms
11,520 KB
testcase_35 AC 31 ms
11,520 KB
testcase_36 AC 32 ms
11,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
from typing import *

def foo(k, value, a):
    for i in range(len(a)):
        delta = min(k, a[i] // value)
        k -= delta
        a[i] -= delta * value
    a.sort()
    while k and a:
        assert a[-1] < value
        k -= 1
        a.pop()

def solve(n: int, x: int, y: int, z: int, a: List[int]) -> bool:
    foo(z, 10000, a)
    foo(y, 5000, a)
    foo(x, 1000, a)
    return not a

# generated by online-judge-template-generator (https://github.com/kmyk/online-judge-template-generator)
def main():
    import sys
    tokens = iter(sys.stdin.read().split())
    N = int(next(tokens))
    X = int(next(tokens))
    Y = int(next(tokens))
    Z = int(next(tokens))
    A = [None for _ in range(N)]
    for i in range(N):
        A[i] = int(next(tokens))
    assert next(tokens, None) is None
    ans = solve(N, X, Y, Z, A)
    print(ans and 'Yes' or 'No')

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