結果

問題 No.1645 AB's abs
ユーザー umaruuuunumaruuuun
提出日時 2021-08-20 15:16:52
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 371 bytes
コンパイル時間 486 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 86,912 KB
最終ジャッジ日時 2024-04-21 19:36:30
合計ジャッジ時間 6,555 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
67,072 KB
testcase_01 AC 62 ms
62,336 KB
testcase_02 AC 102 ms
75,136 KB
testcase_03 AC 66 ms
62,208 KB
testcase_04 AC 76 ms
66,816 KB
testcase_05 AC 75 ms
67,328 KB
testcase_06 AC 81 ms
69,632 KB
testcase_07 AC 75 ms
67,072 KB
testcase_08 AC 104 ms
76,672 KB
testcase_09 AC 102 ms
77,184 KB
testcase_10 AC 101 ms
76,160 KB
testcase_11 AC 104 ms
76,032 KB
testcase_12 AC 102 ms
76,160 KB
testcase_13 AC 138 ms
86,016 KB
testcase_14 AC 135 ms
85,248 KB
testcase_15 AC 141 ms
86,272 KB
testcase_16 AC 139 ms
85,504 KB
testcase_17 AC 139 ms
86,016 KB
testcase_18 AC 137 ms
85,376 KB
testcase_19 AC 139 ms
86,272 KB
testcase_20 AC 137 ms
84,992 KB
testcase_21 AC 142 ms
85,376 KB
testcase_22 AC 142 ms
86,144 KB
testcase_23 AC 142 ms
86,528 KB
testcase_24 AC 141 ms
86,528 KB
testcase_25 AC 148 ms
86,912 KB
testcase_26 AC 143 ms
86,528 KB
testcase_27 AC 148 ms
86,528 KB
testcase_28 AC 143 ms
86,528 KB
testcase_29 AC 144 ms
86,400 KB
testcase_30 AC 141 ms
86,528 KB
testcase_31 AC 145 ms
86,528 KB
testcase_32 AC 140 ms
86,272 KB
testcase_33 AC 143 ms
85,888 KB
testcase_34 AC 141 ms
85,888 KB
testcase_35 AC 148 ms
85,760 KB
testcase_36 AC 140 ms
85,632 KB
testcase_37 AC 142 ms
85,816 KB
testcase_38 AC 137 ms
85,888 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
dp=[[0]*20001 for i in range(n+1)]
dp[0][0]=1
mod=998244353
for i in range(n):
    for j in range(-10000,10000):
        dp[i+1][j+a[i]]+=dp[i][j]
        dp[i+1][j-a[i]]+=dp[i][j]
        dp[i+1][j+a[i]]%=mod
        dp[i+1][j-a[i]]%=mod
ans=0
for i in range(-10000,10001):
    ans+=abs(i)*dp[n][i]
    ans%=mod
print(ans)
0