結果

問題 No.1015 おつりは要らないです
ユーザー stngstng
提出日時 2022-08-19 21:38:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,444 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 82,028 KB
実行使用メモリ 79,140 KB
最終ジャッジ日時 2024-04-17 00:18:18
合計ジャッジ時間 3,415 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,612 KB
testcase_01 AC 35 ms
52,628 KB
testcase_02 AC 36 ms
52,512 KB
testcase_03 AC 35 ms
52,872 KB
testcase_04 AC 36 ms
53,420 KB
testcase_05 AC 37 ms
53,136 KB
testcase_06 AC 35 ms
52,788 KB
testcase_07 AC 35 ms
53,412 KB
testcase_08 AC 36 ms
54,092 KB
testcase_09 AC 37 ms
54,188 KB
testcase_10 AC 58 ms
78,408 KB
testcase_11 AC 58 ms
78,224 KB
testcase_12 AC 60 ms
77,052 KB
testcase_13 AC 59 ms
78,748 KB
testcase_14 AC 61 ms
79,056 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 59 ms
76,952 KB
testcase_21 AC 59 ms
77,728 KB
testcase_22 AC 58 ms
78,096 KB
testcase_23 AC 59 ms
76,452 KB
testcase_24 AC 59 ms
76,432 KB
testcase_25 AC 59 ms
77,292 KB
testcase_26 AC 59 ms
77,540 KB
testcase_27 AC 57 ms
76,708 KB
testcase_28 AC 59 ms
77,240 KB
testcase_29 AC 59 ms
77,708 KB
testcase_30 AC 37 ms
53,536 KB
testcase_31 AC 55 ms
72,000 KB
testcase_32 AC 55 ms
72,388 KB
testcase_33 AC 61 ms
78,864 KB
testcase_34 AC 37 ms
52,900 KB
testcase_35 AC 37 ms
53,056 KB
testcase_36 AC 36 ms
52,688 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,x,y,z = map(int,input().split())
a = [int(i) for i in input().split()]

man = 0
li = [0]*10

for i in range(n):
    a[i] = 1000 + (a[i] // 1000)*1000
    tmp = a[i]//10000
    man += tmp
    li[(a[i]-tmp*10000)//1000] += 1


if man <= z:
    z -= man
    man = 0
else:
    man -= z
    z = 0

if man != 0:
    if man <= y//2:
        y -= man*2
        man = 0
    else:
        man -= y//2
        y = 0

if man != 0:
    if man*10 <= y*5+x:
        y = 0
        x -= (man*10-5*y)//10
        man = 0
    else:
        print("No")
        exit()

for i in range(9,0,-1):
    if li[i] <= z:
        z -= li[i]
        li[i] = 0
    else:
        li[i] -= z
        break

for i in range(9,4,-1):
    if li[i] <= y:
        li[i-5] += li[i]
        y -= li[i]
        li[i] = 0
    else:
        li[i-5] += y
        y = 0
        li[i] -= y
if y > 0:
    for i in range(5):
        if li[9-i] <= y:
            li[4-i] += li[9-i]
            y -= li[9-i]
        else:
            li[4-i] += y
            y = 0
            li[9-i] -= y
            break
if y > 0:
    for i in range(4):
        if li[4-i] <= y:
            y -= li[4-i]
            li[4-i] = 0
        else:
            li[4-i] -= y
            y = 0
            break
#print(x,y,z,li)
for i in range(9):
    tmp = 9-i
    #print(tmp,li[9-i],z)
    if li[9-i]*tmp <= x:
        x -= li[9-i]*tmp
        li[9-i] = 0
    else:
        print("No")
        exit()

print("Yes")
0