結果

問題 No.2625 Bouns Ai
ユーザー hato336hato336
提出日時 2024-02-10 09:10:16
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,166 ms / 2,000 ms
コード長 1,066 bytes
コンパイル時間 422 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 456,856 KB
最終ジャッジ日時 2024-02-10 09:10:45
合計ジャッジ時間 25,618 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 139 ms
102,328 KB
testcase_01 AC 126 ms
95,416 KB
testcase_02 AC 186 ms
134,200 KB
testcase_03 AC 1,058 ms
454,940 KB
testcase_04 AC 1,066 ms
455,660 KB
testcase_05 AC 865 ms
455,568 KB
testcase_06 AC 808 ms
456,672 KB
testcase_07 AC 864 ms
455,568 KB
testcase_08 AC 880 ms
455,812 KB
testcase_09 AC 835 ms
456,452 KB
testcase_10 AC 1,022 ms
455,132 KB
testcase_11 AC 147 ms
109,496 KB
testcase_12 AC 1,109 ms
456,060 KB
testcase_13 AC 1,166 ms
456,184 KB
testcase_14 AC 1,120 ms
456,088 KB
testcase_15 AC 1,123 ms
455,632 KB
testcase_16 AC 1,082 ms
455,380 KB
testcase_17 AC 1,112 ms
455,824 KB
testcase_18 AC 1,092 ms
456,200 KB
testcase_19 AC 1,114 ms
455,376 KB
testcase_20 AC 1,132 ms
455,496 KB
testcase_21 AC 1,108 ms
455,916 KB
testcase_22 AC 1,144 ms
456,788 KB
testcase_23 AC 1,163 ms
455,924 KB
testcase_24 AC 1,108 ms
456,856 KB
testcase_25 AC 1,111 ms
455,372 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
#input = sys.stdin.readline
n = int(input())
alist = list(map(int,input().split()))
#alist = []
#s = input()
#n,m = map(int,input().split())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
dp = [[0 for i in range(100001)] for j in range(n)]
sumdp = []
mod = 998244353
for i in range(n):
    if i == 0:
        for j in range(100001):
            if alist[i]+j <= 100000:
                dp[i][j] = 1
    else:
        for j in range(100001):
            if alist[i]+j > 100000:
                continue
            if 0 <= min(j,j-alist[i-1]+alist[i]) <= 100000:
                dp[i][j] = sumdp[-1][min(j,j-alist[i-1]+alist[i])]
                dp[i][j] %= mod
    sumdp.append(list(itertools.accumulate(dp[i],func=lambda x,y:(x+y)%mod)))
ans = 0
for i in range(100001):
    if i + alist[-1] <= 100000:
        ans += dp[-1][i]
        ans %= mod
        #print(dp[-1][i],i)
print(ans)
0