結果

問題 No.2625 Bouns Ai
ユーザー PNJPNJ
提出日時 2024-02-09 22:24:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 801 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 229,376 KB
最終ジャッジ日時 2024-02-09 22:24:33
合計ジャッジ時間 16,523 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
61,464 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 94 ms
77,460 KB
testcase_03 AC 426 ms
218,796 KB
testcase_04 WA -
testcase_05 AC 422 ms
220,896 KB
testcase_06 AC 465 ms
220,896 KB
testcase_07 AC 427 ms
220,896 KB
testcase_08 AC 441 ms
220,892 KB
testcase_09 AC 466 ms
218,792 KB
testcase_10 AC 740 ms
225,084 KB
testcase_11 AC 62 ms
66,580 KB
testcase_12 AC 784 ms
224,568 KB
testcase_13 AC 791 ms
227,276 KB
testcase_14 AC 759 ms
227,268 KB
testcase_15 AC 799 ms
227,288 KB
testcase_16 AC 778 ms
227,280 KB
testcase_17 AC 772 ms
227,284 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def Map():
  return list(map(int,input().split()))

mod = 998244353
N = int(input())
A = Map()
S = 10**5
if N == 1:
  print(S + 1 - A[0])
  exit()
dp = [[0 for j in range(S + 1)] for i in range(N)]
for s in range(S + 1):
  if s + A[0] > S:
    break
  dp[0][s] += 1

for n in range(N-1):
  d = 0
  if A[n] - A[n+1] > 0:
    d += A[n] - A[n+1]
  for s in range(S+1):
    if n > 0 and s < S:
      dp[n][s+1] += dp[n][s]
      dp[n][s+1] %= mod
    if s + d > S:
      continue
    ss = s + d
    if ss + A[n+1] > S:
      continue
    sss = S - A[n+1] + 1
    dp[n+1][ss] += dp[n][s]
    dp[n+1][ss] %= mod
    if sss <= S:
      dp[n+1][sss] -= dp[n][s]
      dp[n+1][sss] %= mod
ans = 0
for s in range(S):
  dp[N-1][s+1] += dp[N-1][s]
  dp[N-1][s+1] %= mod
  ans += dp[N-1][s]
  ans %= mod
print(ans)
0