結果

問題 No.1457 ツブ消ししとるなHard
ユーザー rlangevinrlangevin
提出日時 2023-01-18 23:52:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 169 ms / 2,000 ms
コード長 604 bytes
コンパイル時間 529 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 131,304 KB
最終ジャッジ日時 2023-09-02 16:52:45
合計ジャッジ時間 4,740 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 102 ms
86,828 KB
testcase_01 AC 73 ms
71,272 KB
testcase_02 AC 94 ms
83,440 KB
testcase_03 AC 91 ms
82,568 KB
testcase_04 AC 153 ms
131,240 KB
testcase_05 AC 150 ms
128,980 KB
testcase_06 AC 153 ms
131,304 KB
testcase_07 AC 71 ms
71,432 KB
testcase_08 AC 76 ms
71,336 KB
testcase_09 AC 122 ms
104,076 KB
testcase_10 AC 123 ms
104,480 KB
testcase_11 AC 98 ms
87,636 KB
testcase_12 AC 169 ms
131,304 KB
testcase_13 AC 126 ms
104,428 KB
testcase_14 AC 120 ms
104,468 KB
testcase_15 AC 155 ms
118,348 KB
testcase_16 AC 152 ms
131,180 KB
testcase_17 AC 73 ms
71,360 KB
testcase_18 AC 81 ms
78,092 KB
testcase_19 AC 153 ms
131,200 KB
testcase_20 AC 81 ms
77,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(x, a):
    return a + 2500 * x

N, M, X, Y, Z = map(int, input().split())
A = list(map(int, input().split()))
cnt = 0
for a in A:
    if a >= X:
        cnt += 1
if cnt > M:
    print("Handicapped")
    exit()

pre = [0] * (55 * 2500)
pre[f(0, 0)] = 1
for i in range(N):
    dp = [0] * (55 * 2500)
    for j in range(i + 1):
        for a in range(2501):
            if A[i] > Y:
                dp[f(j + 1, a + A[i])] += pre[f(j, a)]
            if A[i] < X:
                dp[f(j, a)] += pre[f(j, a)]
    dp, pre = pre, dp
ans = 0
for i in range(1, M + 1):
    ans += pre[f(i, i * Z)]
print(ans)
0