結果

問題 No.1353 Limited Sequence
ユーザー GER_chenGER_chen
提出日時 2021-01-17 14:37:29
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,117 bytes
コンパイル時間 272 ms
コンパイル使用メモリ 82,052 KB
実行使用メモリ 240,160 KB
最終ジャッジ日時 2024-05-07 03:34:48
合計ジャッジ時間 4,913 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
60,556 KB
testcase_01 AC 82 ms
76,676 KB
testcase_02 AC 92 ms
77,128 KB
testcase_03 AC 57 ms
65,236 KB
testcase_04 AC 63 ms
68,616 KB
testcase_05 AC 78 ms
76,352 KB
testcase_06 AC 72 ms
76,424 KB
testcase_07 AC 99 ms
76,936 KB
testcase_08 AC 91 ms
76,528 KB
testcase_09 AC 99 ms
76,952 KB
testcase_10 AC 84 ms
76,632 KB
testcase_11 AC 81 ms
76,392 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#1353
N, L, R = map(int, input().split())
A = list(map(int, input().split()))
mod = 998244353
DP = [[[0]*((allsum+1)//(last+1)) for last in range(min(N, allsum+1))] for allsum in range(R)]
"""
allsum+1 総和
last+1 最後の数 <= 総和
length+1 最後の数の連続数
"""
for allsum in range(R):
    for last in range(min(N, allsum+1)):
        for length in range((allsum+1)//(last+1)):
            if allsum == last and length == 0:
                DP[allsum][last][length] = 1
                #print(DP)
            elif length > 0:
                if allsum+1 >= 2*last+1:
                    if A[last] >= length+1:
                        DP[allsum][last][length] = DP[allsum-last-1][last][length-1]
            else:
                DP[allsum][last][length] = sum([sum(v) for v in DP[allsum-last-1]])
                try:
                    DP[allsum][last][length] -= sum(DP[allsum-last-1][last])
                except IndexError:
                    pass
                DP[allsum][last][length] %= mod

ans = 0
for i in range(L-1, R):
    ans += sum([sum(v) for v in DP[i]])
print(ans%mod)
#print(DP)
0