結果

問題 No.2625 Bouns Ai
ユーザー nikoro256nikoro256
提出日時 2024-02-09 22:34:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 756 ms / 2,000 ms
コード長 603 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 226,396 KB
最終ジャッジ日時 2024-02-09 22:34:42
合計ジャッジ時間 15,585 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 47 ms
62,248 KB
testcase_01 AC 41 ms
61,208 KB
testcase_02 AC 82 ms
74,556 KB
testcase_03 AC 449 ms
219,592 KB
testcase_04 AC 655 ms
221,704 KB
testcase_05 AC 448 ms
221,700 KB
testcase_06 AC 473 ms
221,700 KB
testcase_07 AC 449 ms
221,700 KB
testcase_08 AC 449 ms
223,784 KB
testcase_09 AC 466 ms
219,592 KB
testcase_10 AC 641 ms
223,788 KB
testcase_11 AC 57 ms
67,244 KB
testcase_12 AC 723 ms
224,308 KB
testcase_13 AC 737 ms
226,388 KB
testcase_14 AC 706 ms
226,384 KB
testcase_15 AC 726 ms
226,384 KB
testcase_16 AC 707 ms
226,384 KB
testcase_17 AC 730 ms
226,384 KB
testcase_18 AC 710 ms
226,384 KB
testcase_19 AC 726 ms
226,384 KB
testcase_20 AC 756 ms
226,388 KB
testcase_21 AC 716 ms
226,384 KB
testcase_22 AC 750 ms
226,396 KB
testcase_23 AC 718 ms
226,396 KB
testcase_24 AC 735 ms
226,396 KB
testcase_25 AC 747 ms
226,396 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
'''
dp[~番目まで見て][仮のスコアが--]
'''
p=998244353
lim=10**5
dp=[[0 for _ in range(lim+1)] for _ in range(N)]
dp[0]=[1 for _ in range(lim+1)]
for i in range(N-1):
    for j in range(lim+1):
        if j+A[i]>lim:
            continue
        move=max(j+A[i]-A[i+1],j)
        if j<=lim:
            dp[i+1][move]+=dp[i][j]
            dp[i+1][move]%=p
    for j in range(1,lim+1):
        dp[i+1][j]+=dp[i+1][j-1]
        dp[i+1][j]%=p
ans=0
for j in range(lim+1):
    if j+A[-1]>lim:
        break
    ans+=dp[-1][j]
    ans%=p
print(ans)
0