結果

問題 No.2625 Bouns Ai
ユーザー mkawa2mkawa2
提出日時 2024-02-09 22:51:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 405 ms / 2,000 ms
コード長 1,166 bytes
コンパイル時間 193 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 222,972 KB
最終ジャッジ日時 2024-02-09 22:52:14
合計ジャッジ時間 7,786 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
61,312 KB
testcase_01 AC 37 ms
60,544 KB
testcase_02 AC 52 ms
69,024 KB
testcase_03 AC 254 ms
216,684 KB
testcase_04 AC 294 ms
218,720 KB
testcase_05 AC 255 ms
218,676 KB
testcase_06 AC 277 ms
218,740 KB
testcase_07 AC 258 ms
218,788 KB
testcase_08 AC 254 ms
218,692 KB
testcase_09 AC 251 ms
216,684 KB
testcase_10 AC 300 ms
218,832 KB
testcase_11 AC 47 ms
64,328 KB
testcase_12 AC 286 ms
218,688 KB
testcase_13 AC 272 ms
218,736 KB
testcase_14 AC 282 ms
220,880 KB
testcase_15 AC 301 ms
220,928 KB
testcase_16 AC 303 ms
220,876 KB
testcase_17 AC 298 ms
220,852 KB
testcase_18 AC 282 ms
220,880 KB
testcase_19 AC 312 ms
220,880 KB
testcase_20 AC 293 ms
220,876 KB
testcase_21 AC 305 ms
220,876 KB
testcase_22 AC 337 ms
220,816 KB
testcase_23 AC 319 ms
220,832 KB
testcase_24 AC 404 ms
222,972 KB
testcase_25 AC 405 ms
220,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(1000005)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
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 = -1-(-1 << 31)
inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

mx=10**5
n=II()
aa=LI()

# j<=i-a+p

dp=[0]*(mx+1)
for i in range(aa[0],mx+1):dp[i]=1

for i in range(1,n):
    a,p=aa[i],aa[i-1]
    r=min(0,-a+p)
    s=0
    pre,dp=dp,[0]*(mx+1)
    for i in range(mx+1):
        if i+r>=0:
            s+=pre[i+r]
            s%=md
        if i<a:continue
        dp[i]+=s
        dp[i]%=md
    # print(dp)

ans=0
for d in dp:
    ans+=d
    ans%=md
print(ans)

0