結果

問題 No.2215 Slide Subset Sum
ユーザー tktk_snsntktk_snsn
提出日時 2023-02-11 02:36:55
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 989 bytes
コンパイル時間 876 ms
コンパイル使用メモリ 87,136 KB
実行使用メモリ 665,380 KB
最終ジャッジ日時 2023-09-22 02:41:13
合計ジャッジ時間 37,544 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 287 ms
99,820 KB
testcase_01 AC 692 ms
99,976 KB
testcase_02 AC 749 ms
112,076 KB
testcase_03 AC 736 ms
107,568 KB
testcase_04 AC 1,117 ms
277,784 KB
testcase_05 AC 70 ms
71,320 KB
testcase_06 AC 75 ms
76,160 KB
testcase_07 AC 70 ms
71,132 KB
testcase_08 AC 70 ms
71,428 KB
testcase_09 AC 71 ms
71,236 KB
testcase_10 AC 72 ms
71,340 KB
testcase_11 AC 70 ms
71,344 KB
testcase_12 AC 81 ms
76,476 KB
testcase_13 AC 86 ms
76,820 KB
testcase_14 AC 81 ms
76,480 KB
testcase_15 AC 74 ms
75,976 KB
testcase_16 AC 91 ms
76,684 KB
testcase_17 AC 1,651 ms
490,876 KB
testcase_18 AC 1,404 ms
373,544 KB
testcase_19 AC 1,050 ms
280,136 KB
testcase_20 AC 1,240 ms
448,852 KB
testcase_21 AC 1,142 ms
283,044 KB
testcase_22 AC 1,299 ms
471,288 KB
testcase_23 MLE -
testcase_24 MLE -
testcase_25 MLE -
testcase_26 AC 1,364 ms
473,796 KB
testcase_27 AC 132 ms
81,024 KB
testcase_28 AC 193 ms
107,084 KB
testcase_29 AC 189 ms
107,328 KB
testcase_30 AC 407 ms
95,392 KB
testcase_31 AC 771 ms
278,424 KB
testcase_32 AC 195 ms
105,488 KB
testcase_33 AC 819 ms
274,908 KB
testcase_34 AC 934 ms
285,784 KB
testcase_35 AC 206 ms
108,136 KB
testcase_36 AC 399 ms
184,376 KB
testcase_37 AC 1,289 ms
447,424 KB
testcase_38 AC 265 ms
139,832 KB
testcase_39 AC 714 ms
99,932 KB
testcase_40 AC 298 ms
99,972 KB
testcase_41 AC 75 ms
71,552 KB
testcase_42 AC 1,228 ms
447,216 KB
testcase_43 AC 1,036 ms
280,908 KB
testcase_44 AC 1,034 ms
280,836 KB
testcase_45 MLE -
testcase_46 MLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 998244353


def merge(X, Y, K):
    res = X[0] * Y[0] - 1
    for i in range(1, K):
        res += X[i] * Y[K - i]
        res %= mod
    return res


def calc_dp(K, A):
    dp = [0] * K
    dp[0] = 1
    for a in A:
        tmp = [0] * K
        for i in range(K):
            tmp[i] = dp[i - a]
        for i in range(K):
            dp[i] += tmp[i]
            dp[i] %= mod
        yield dp[:]


def main():
    N, M, K = map(int, input().split())
    block = (N + M - 1) // M
    A = [0] * (block * M + M)
    for i, a in enumerate(map(int, input().split())):
        A[i] = a

    answer = []
    for i in range(block):
        L = [A[j] for j in range(M*i, M*i+M)][::-1]
        R = [A[j] for j in range(M*i+M, M*i+2*M)]

        dpL = list(calc_dp(K, L))[::-1]
        dpR = list(calc_dp(K, R))

        answer.append((dpL[0][0] - 1) % mod)
        for j in range(M - 1):
            answer.append(merge(dpL[j+1], dpR[j], K))

    print(*answer[:N - M + 1], sep="\n")


main()
0