結果

問題 No.1015 おつりは要らないです
ユーザー stngstng
提出日時 2022-08-19 21:17:05
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,428 bytes
コンパイル時間 395 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 78,080 KB
最終ジャッジ日時 2024-04-16 23:56:32
合計ジャッジ時間 4,184 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
52,096 KB
testcase_01 AC 55 ms
52,096 KB
testcase_02 AC 44 ms
51,968 KB
testcase_03 AC 45 ms
51,840 KB
testcase_04 AC 45 ms
52,096 KB
testcase_05 AC 45 ms
52,480 KB
testcase_06 AC 45 ms
52,096 KB
testcase_07 AC 46 ms
52,096 KB
testcase_08 AC 47 ms
51,840 KB
testcase_09 AC 47 ms
52,224 KB
testcase_10 AC 77 ms
77,184 KB
testcase_11 AC 78 ms
77,184 KB
testcase_12 AC 76 ms
76,544 KB
testcase_13 AC 78 ms
76,800 KB
testcase_14 AC 72 ms
77,184 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 74 ms
76,032 KB
testcase_21 AC 70 ms
76,160 KB
testcase_22 AC 70 ms
76,160 KB
testcase_23 AC 69 ms
76,160 KB
testcase_24 AC 70 ms
76,416 KB
testcase_25 AC 71 ms
76,544 KB
testcase_26 AC 71 ms
76,416 KB
testcase_27 AC 69 ms
76,160 KB
testcase_28 AC 69 ms
76,160 KB
testcase_29 AC 70 ms
76,544 KB
testcase_30 AC 44 ms
51,840 KB
testcase_31 AC 64 ms
71,424 KB
testcase_32 AC 65 ms
71,936 KB
testcase_33 AC 74 ms
78,080 KB
testcase_34 AC 42 ms
51,968 KB
testcase_35 AC 41 ms
52,224 KB
testcase_36 AC 44 ms
52,224 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:
        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