結果

問題 No.1457 ツブ消ししとるなHard
ユーザー aaaaaaaaaa2230
提出日時 2021-04-01 09:32:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 550 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 82,164 KB
実行使用メモリ 67,788 KB
最終ジャッジ日時 2024-12-17 13:34:08
合計ジャッジ時間 2,023 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 16 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m,x,y,z = map(int,input().split())
A = list(map(int,input().split()))

dp = [0]*(10010)
dp[0] = 1
need = 0
for a in A:
    if a <= y:
        continue

    ndp = [0]*(10010)
    if a >= x:
        need += 1
        for i in range(-5000,5000):
            if dp[i]:
                ndp[i+a-z] += dp[i]
    else:
        for i in range(-5000,5000):
            if dp[i]:
                ndp[i] += dp[i]
                ndp[i+a-z] += dp[i]
    dp = ndp
ans = dp[0]
if need > m:
    print("Handicapped")
    exit()
if need == 0:
    ans -= 1
print(ans)
0