結果

問題 No.1015 おつりは要らないです
ユーザー Adam Jimenez
提出日時 2020-04-03 21:43:36
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 17,568 KB
最終ジャッジ日時 2024-07-03 01:52:05
合計ジャッジ時間 4,252 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other TLE * 1 -- * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

n, x,y,z = [int(x) for x in input().split()]
coins = [[ x,1000 ], [ y,5000 ], [ z,10000 ]]
ax = [int(x) for x in input().split()]

def solve():
    global x,y,z
    global coins
    idx=0
    while(idx<len(ax) and ax[idx] <= 0): idx+=1
    if idx == len(ax): return True
    for i in range(len(coins)):
        cnt,val = coins[i]
        if cnt <= 0:
            continue
        coins[i][0]-=1
        ax[idx]-=val
        if solve():
            return True
        ax[idx]+=val
        coins[i][0]+=1
    return False

print("Yes" if solve() else "No")


0