結果

問題 No.1353 Limited Sequence
ユーザー mkawa2mkawa2
提出日時 2021-09-17 12:34:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 498 ms / 2,000 ms
コード長 1,051 bytes
コンパイル時間 383 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 109,328 KB
最終ジャッジ日時 2023-09-12 04:22:16
合計ジャッジ時間 13,792 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
75,696 KB
testcase_01 AC 80 ms
76,664 KB
testcase_02 AC 80 ms
76,416 KB
testcase_03 AC 81 ms
76,464 KB
testcase_04 AC 77 ms
76,440 KB
testcase_05 AC 80 ms
76,852 KB
testcase_06 AC 80 ms
76,892 KB
testcase_07 AC 81 ms
76,816 KB
testcase_08 AC 78 ms
76,764 KB
testcase_09 AC 80 ms
76,812 KB
testcase_10 AC 79 ms
76,876 KB
testcase_11 AC 78 ms
76,824 KB
testcase_12 AC 294 ms
103,156 KB
testcase_13 AC 352 ms
107,504 KB
testcase_14 AC 112 ms
87,212 KB
testcase_15 AC 185 ms
94,788 KB
testcase_16 AC 89 ms
76,720 KB
testcase_17 AC 103 ms
84,376 KB
testcase_18 AC 297 ms
102,436 KB
testcase_19 AC 351 ms
104,008 KB
testcase_20 AC 147 ms
91,528 KB
testcase_21 AC 108 ms
86,592 KB
testcase_22 AC 107 ms
85,384 KB
testcase_23 AC 303 ms
103,008 KB
testcase_24 AC 241 ms
99,872 KB
testcase_25 AC 331 ms
103,688 KB
testcase_26 AC 209 ms
96,892 KB
testcase_27 AC 165 ms
96,096 KB
testcase_28 AC 128 ms
88,848 KB
testcase_29 AC 140 ms
91,352 KB
testcase_30 AC 289 ms
105,864 KB
testcase_31 AC 200 ms
97,764 KB
testcase_32 AC 122 ms
90,740 KB
testcase_33 AC 96 ms
87,032 KB
testcase_34 AC 164 ms
108,296 KB
testcase_35 AC 110 ms
91,116 KB
testcase_36 AC 114 ms
91,116 KB
testcase_37 AC 487 ms
109,104 KB
testcase_38 AC 468 ms
109,020 KB
testcase_39 AC 470 ms
109,172 KB
testcase_40 AC 498 ms
108,864 KB
testcase_41 AC 497 ms
108,708 KB
testcase_42 AC 473 ms
109,008 KB
testcase_43 AC 487 ms
109,088 KB
testcase_44 AC 486 ms
109,000 KB
testcase_45 AC 474 ms
109,192 KB
testcase_46 AC 493 ms
109,328 KB
testcase_47 AC 177 ms
109,004 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

sys.setrecursionlimit(200005)
int1 = lambda x: int(x)-1
p2D = lambda x: print(*x, sep="\n")
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()
dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
inf = 10**16
md = 998244353
# md = 10**9+7

n, l, r = LI()
aa = [0]+LI()

mx = 2005
dp = [[0]*(r+1) for _ in range(mx)]
cs = [0]*(r+1)
cs[0] = 1

for s in range(1, r+1):
    for i in range(1, min(s,n)+1):
        for j in range(1, aa[i]+1):
            if s-i*j < 0: break
            dp[s][i] += cs[s-i*j]-dp[s-i*j][i]
            dp[s][i] %= md
        cs[s] += dp[s][i]
        cs[s] %= md
# print(cs)

ans = 0
for i in range(l, r+1):
    ans += cs[i]
    ans %= md

print(ans)
0