結果

問題 No.1015 おつりは要らないです
ユーザー maspymaspy
提出日時 2020-03-11 08:44:54
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 857 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,800 KB
実行使用メモリ 23,212 KB
最終ジャッジ日時 2024-05-06 01:03:22
合計ジャッジ時間 6,686 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 25 ms
10,624 KB
testcase_02 AC 26 ms
10,496 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 26 ms
10,752 KB
testcase_08 AC 26 ms
10,624 KB
testcase_09 AC 26 ms
10,496 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 222 ms
22,128 KB
testcase_16 AC 248 ms
22,692 KB
testcase_17 AC 235 ms
22,872 KB
testcase_18 AC 229 ms
22,592 KB
testcase_19 AC 227 ms
22,424 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 26 ms
10,624 KB
testcase_31 WA -
testcase_32 AC 159 ms
13,136 KB
testcase_33 AC 198 ms
22,496 KB
testcase_34 WA -
testcase_35 AC 26 ms
10,624 KB
testcase_36 AC 27 ms
10,496 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/python3.8
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def solve(A, X, Y, Z):
    A = [x + 1 for x in A]
    N = len(A)
    A.sort(key=lambda x: x % 5000, reverse=True)
    for i in range(N):
        x = (-A[i]) % 5000
        use = min((x + 999) // 1000, X)
        A[i] -= use * 1000
        X -= use
        if A[i] < 0:
            A[i] = 0
    Y += X // 5
    A.sort(key=lambda x: x % 10000, reverse=True)
    for i in range(N):
        x = (-A[i]) % 10000
        use = min((x + 4999) // 5000, Y)
        A[i] -= use * 5000
        Y -= use
        if A[i] < 0:
            A[i] = 0
    Z += Y // 2
    use = sum((x + 9999) // 10000 for x in A)
    return use <= Z


if __name__ == '__main__':
    N, X, Y, Z, *A = map(int, read().split())
    print('Yes' if solve(A, X, Y, Z) else 'No')
0