結果

問題 No.1457 ツブ消ししとるなHard
ユーザー first_vilfirst_vil
提出日時 2021-11-12 10:53:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 386 ms / 2,000 ms
コード長 602 bytes
コンパイル時間 1,538 ms
コンパイル使用メモリ 86,724 KB
実行使用メモリ 99,244 KB
最終ジャッジ日時 2023-08-16 07:57:54
合計ジャッジ時間 7,579 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 115 ms
78,052 KB
testcase_01 AC 75 ms
71,144 KB
testcase_02 AC 114 ms
77,236 KB
testcase_03 AC 105 ms
77,116 KB
testcase_04 AC 363 ms
99,244 KB
testcase_05 AC 337 ms
98,208 KB
testcase_06 AC 386 ms
98,996 KB
testcase_07 AC 72 ms
71,172 KB
testcase_08 AC 70 ms
71,060 KB
testcase_09 AC 170 ms
80,440 KB
testcase_10 AC 184 ms
80,960 KB
testcase_11 AC 115 ms
78,068 KB
testcase_12 AC 339 ms
95,624 KB
testcase_13 AC 178 ms
81,292 KB
testcase_14 AC 123 ms
77,540 KB
testcase_15 AC 243 ms
84,084 KB
testcase_16 AC 324 ms
98,188 KB
testcase_17 AC 71 ms
71,168 KB
testcase_18 AC 83 ms
75,676 KB
testcase_19 AC 356 ms
97,180 KB
testcase_20 AC 87 ms
75,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from bisect import *

N,M,X,Y,Z = map(int,input().split())
A = list(map(int,input().split()))

y = bisect_right(A,Y)
x = bisect_left(A,X)
if N-x > M:
    print("Handicapped")
    exit(0)

s = 2500
dp = [[0]*(s*2+100) for i in range(M+1)]
dp[0][0] = 1
for a in A:
    nxt = [[0]*(s*2+100) for i in range(M+1)]
    for i in range(M+1):
        for j in range(-s,s+1):
            if i+1 <= M and Y < a and -s <= j+a-Z <= s:
                nxt[i+1][j+a-Z] += dp[i][j]
            if a < X:
                nxt[i][j] += dp[i][j]
    dp = nxt

ans = 0
for i in range(1,M+1):
    ans += dp[i][0]
print(ans)
0