結果

問題 No.1645 AB's abs
ユーザー tassei903tassei903
提出日時 2021-08-13 21:42:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 95 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 434 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 77,384 KB
最終ジャッジ日時 2024-04-14 17:19:29
合計ジャッジ時間 5,000 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
62,068 KB
testcase_01 AC 44 ms
60,200 KB
testcase_02 AC 54 ms
68,440 KB
testcase_03 AC 45 ms
61,748 KB
testcase_04 AC 47 ms
62,220 KB
testcase_05 AC 47 ms
62,308 KB
testcase_06 AC 50 ms
63,612 KB
testcase_07 AC 48 ms
62,004 KB
testcase_08 AC 56 ms
69,608 KB
testcase_09 AC 56 ms
69,624 KB
testcase_10 AC 56 ms
69,156 KB
testcase_11 AC 55 ms
68,532 KB
testcase_12 AC 55 ms
69,188 KB
testcase_13 AC 95 ms
76,964 KB
testcase_14 AC 89 ms
76,256 KB
testcase_15 AC 92 ms
77,088 KB
testcase_16 AC 89 ms
76,528 KB
testcase_17 AC 88 ms
76,488 KB
testcase_18 AC 89 ms
76,540 KB
testcase_19 AC 92 ms
77,116 KB
testcase_20 AC 88 ms
76,424 KB
testcase_21 AC 88 ms
76,392 KB
testcase_22 AC 92 ms
76,436 KB
testcase_23 AC 91 ms
77,228 KB
testcase_24 AC 92 ms
77,328 KB
testcase_25 AC 90 ms
77,384 KB
testcase_26 AC 91 ms
77,256 KB
testcase_27 AC 91 ms
77,196 KB
testcase_28 AC 92 ms
76,960 KB
testcase_29 AC 93 ms
77,120 KB
testcase_30 AC 93 ms
77,080 KB
testcase_31 AC 92 ms
77,176 KB
testcase_32 AC 92 ms
77,168 KB
testcase_33 AC 94 ms
77,248 KB
testcase_34 AC 95 ms
77,356 KB
testcase_35 AC 95 ms
77,036 KB
testcase_36 AC 93 ms
76,900 KB
testcase_37 AC 92 ms
77,112 KB
testcase_38 AC 90 ms
77,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
sys.setrecursionlimit(10**7)
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################

n = ni()
a = na()
M = 10101
dp = [0 for j in range(M)]
dp[0] = 1
for i in range(n):
    ndp = [0]*M
    for j in range(M):
        if j+a[i]<M:
            ndp[(j+a[i])]+=dp[j]
        ndp[abs(j-a[i])]+=dp[j]
    dp = ndp.copy()

ans = 0
mod = 998244353
for i in range(M):
    ans+=i*dp[i]
    ans%=mod
print(ans)
0