結果

問題 No.1457 ツブ消ししとるなHard
ユーザー first_vilfirst_vil
提出日時 2021-11-12 10:54:06
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 602 bytes
コンパイル時間 585 ms
コンパイル使用メモリ 10,876 KB
実行使用メモリ 16,788 KB
最終ジャッジ日時 2023-08-16 07:58:03
合計ジャッジ時間 4,761 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 216 ms
15,932 KB
testcase_01 AC 17 ms
8,188 KB
testcase_02 AC 76 ms
8,512 KB
testcase_03 AC 47 ms
8,448 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

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