結果

問題 No.1457 ツブ消ししとるなHard
ユーザー convexineqconvexineq
提出日時 2021-05-05 21:13:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 174 ms / 2,000 ms
コード長 434 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 86,748 KB
実行使用メモリ 88,476 KB
最終ジャッジ日時 2023-10-11 15:16:26
合計ジャッジ時間 3,630 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 96 ms
71,548 KB
testcase_01 AC 96 ms
71,536 KB
testcase_02 AC 96 ms
71,604 KB
testcase_03 AC 96 ms
71,620 KB
testcase_04 AC 104 ms
76,940 KB
testcase_05 AC 104 ms
77,008 KB
testcase_06 AC 174 ms
88,476 KB
testcase_07 AC 97 ms
71,640 KB
testcase_08 AC 96 ms
71,392 KB
testcase_09 AC 105 ms
76,984 KB
testcase_10 AC 105 ms
76,972 KB
testcase_11 AC 98 ms
71,540 KB
testcase_12 AC 119 ms
78,328 KB
testcase_13 AC 111 ms
77,196 KB
testcase_14 AC 110 ms
77,396 KB
testcase_15 AC 109 ms
77,448 KB
testcase_16 AC 97 ms
71,560 KB
testcase_17 AC 108 ms
77,028 KB
testcase_18 AC 95 ms
71,648 KB
testcase_19 AC 110 ms
77,272 KB
testcase_20 AC 96 ms
71,376 KB
権限があれば一括ダウンロードができます

ソースコード

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)) - (1 if C==0 else 0) if C <= m else "Handicapped")
0