結果

問題 No.2625 Bouns Ai
ユーザー rlangevinrlangevin
提出日時 2024-02-09 22:36:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 412 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 223,688 KB
最終ジャッジ日時 2024-02-09 22:36:19
合計ジャッジ時間 10,098 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
62,232 KB
testcase_01 AC 36 ms
61,088 KB
testcase_02 AC 57 ms
69,848 KB
testcase_03 AC 368 ms
219,604 KB
testcase_04 AC 375 ms
219,612 KB
testcase_05 AC 388 ms
219,604 KB
testcase_06 AC 365 ms
219,604 KB
testcase_07 AC 382 ms
219,604 KB
testcase_08 AC 383 ms
219,604 KB
testcase_09 AC 397 ms
219,604 KB
testcase_10 AC 372 ms
219,612 KB
testcase_11 AC 45 ms
65,108 KB
testcase_12 AC 382 ms
219,608 KB
testcase_13 AC 404 ms
221,568 KB
testcase_14 AC 383 ms
221,568 KB
testcase_15 AC 377 ms
223,688 KB
testcase_16 AC 412 ms
221,584 KB
testcase_17 AC 383 ms
223,688 KB
testcase_18 AC 384 ms
221,568 KB
testcase_19 AC 404 ms
221,568 KB
testcase_20 AC 382 ms
221,664 KB
testcase_21 AC 391 ms
221,568 KB
testcase_22 AC 406 ms
221,568 KB
testcase_23 AC 385 ms
221,568 KB
testcase_24 AC 380 ms
221,568 KB
testcase_25 AC 382 ms
221,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
M = 10**5
pre = [0] * (M + 2)
for i in range(A[0], M + 1):
    pre[i] = 1
    
mod = 998244353
for i in range(1, N):
    dp = [0] * (M + 2)
    da = max(0, A[i] - A[i - 1])
    for j in range(M + 1):
        mi = min(M + 1 - j, da)
        dp[j + mi] += pre[j]
        dp[j + mi] %= mod
    for j in range(1, M + 1):
        dp[j] += dp[j - 1]
        dp[j] %= mod
    dp, pre = pre, dp
    
print(sum(pre[:M+1])%mod)
0