結果

問題 No.2625 Bouns Ai
ユーザー 👑 timitimi
提出日時 2024-02-09 22:38:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 797 ms / 2,000 ms
コード長 385 bytes
コンパイル時間 148 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 241,204 KB
最終ジャッジ日時 2024-02-09 22:38:57
合計ジャッジ時間 16,320 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
67,468 KB
testcase_01 AC 40 ms
60,304 KB
testcase_02 AC 111 ms
129,452 KB
testcase_03 AC 530 ms
236,424 KB
testcase_04 AC 675 ms
240,352 KB
testcase_05 AC 528 ms
237,284 KB
testcase_06 AC 561 ms
237,520 KB
testcase_07 AC 527 ms
237,284 KB
testcase_08 AC 560 ms
238,756 KB
testcase_09 AC 521 ms
236,428 KB
testcase_10 AC 690 ms
241,204 KB
testcase_11 AC 62 ms
79,000 KB
testcase_12 AC 755 ms
240,768 KB
testcase_13 AC 710 ms
240,428 KB
testcase_14 AC 753 ms
240,432 KB
testcase_15 AC 689 ms
240,424 KB
testcase_16 AC 732 ms
240,440 KB
testcase_17 AC 686 ms
240,424 KB
testcase_18 AC 782 ms
240,688 KB
testcase_19 AC 768 ms
240,824 KB
testcase_20 AC 751 ms
240,580 KB
testcase_21 AC 751 ms
238,908 KB
testcase_22 AC 747 ms
240,544 KB
testcase_23 AC 738 ms
239,016 KB
testcase_24 AC 797 ms
240,672 KB
testcase_25 AC 729 ms
240,548 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int, input().split()))
c=10**5+1
mod=998244353
for i in range(N):
  a=A[i]
  if i==0:
    dp=[0]*c
    for j in range(c-a):
      dp[j+a]=1
  else:
    D=[0];aa=A[i-1]
    for d in dp:
      D.append(D[-1]+d)
    ndp=[0]*c
    for j in range(a,c):
      d=min(j,j-a+aa)
      if d>=0:
        ndp[j]+=D[d+1] 
        ndp[j]%=mod
    dp=ndp 
print(sum(dp)%mod)
0