結果

問題 No.1015 おつりは要らないです
ユーザー stngstng
提出日時 2022-08-19 21:18:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,442 bytes
コンパイル時間 356 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 78,336 KB
最終ジャッジ日時 2024-04-16 23:57:40
合計ジャッジ時間 3,423 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
51,968 KB
testcase_01 AC 39 ms
52,096 KB
testcase_02 AC 39 ms
52,224 KB
testcase_03 AC 36 ms
52,096 KB
testcase_04 AC 36 ms
52,608 KB
testcase_05 AC 36 ms
52,096 KB
testcase_06 AC 36 ms
52,224 KB
testcase_07 AC 37 ms
52,224 KB
testcase_08 AC 37 ms
52,224 KB
testcase_09 AC 38 ms
52,224 KB
testcase_10 AC 60 ms
76,928 KB
testcase_11 AC 65 ms
77,184 KB
testcase_12 AC 58 ms
76,544 KB
testcase_13 AC 59 ms
76,544 KB
testcase_14 AC 65 ms
77,184 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 58 ms
76,800 KB
testcase_21 AC 56 ms
76,416 KB
testcase_22 AC 58 ms
76,416 KB
testcase_23 AC 59 ms
75,648 KB
testcase_24 AC 56 ms
76,672 KB
testcase_25 AC 56 ms
76,032 KB
testcase_26 AC 59 ms
76,160 KB
testcase_27 AC 59 ms
76,532 KB
testcase_28 AC 59 ms
76,288 KB
testcase_29 AC 59 ms
76,288 KB
testcase_30 AC 37 ms
51,968 KB
testcase_31 AC 51 ms
72,064 KB
testcase_32 AC 53 ms
72,016 KB
testcase_33 AC 60 ms
78,336 KB
testcase_34 AC 37 ms
52,224 KB
testcase_35 AC 37 ms
52,096 KB
testcase_36 AC 37 ms
52,736 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(5,10):
    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