結果

問題 No.1457 ツブ消ししとるなHard
ユーザー convexineq
提出日時 2021-05-05 21:09:51
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 413 bytes
コンパイル時間 427 ms
コンパイル使用メモリ 82,220 KB
実行使用メモリ 83,712 KB
最終ジャッジ日時 2024-09-13 14:03:54
合計ジャッジ時間 2,282 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 9 WA * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,x,y,z = map(int,input().split())
*a, = map(int,input().split())
from collections import defaultdict
dp = defaultdict(int)
dp[(0,0)] = 1
V = C = 0
for ai in a:
    if ai >= x:
        V += ai-z
        C += 1
    elif ai > y:
        ndp = dp.copy()
        for (v,c),r in dp.items():
            ndp[(v+ai-z,c+1)] += r
        dp = ndp
print(sum(dp[(-V,i)] for i in range(m+1-C)) if C <= m else "Handicapped")
0