結果

問題 No.1645 AB's abs
ユーザー DrDrpilotDrDrpilot
提出日時 2022-02-10 11:57:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 147 ms / 2,000 ms
コード長 337 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 100,812 KB
最終ジャッジ日時 2023-09-08 01:09:29
合計ジャッジ時間 7,651 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
77,004 KB
testcase_01 AC 80 ms
76,828 KB
testcase_02 AC 109 ms
84,164 KB
testcase_03 AC 81 ms
76,704 KB
testcase_04 AC 85 ms
77,172 KB
testcase_05 AC 89 ms
77,420 KB
testcase_06 AC 94 ms
78,900 KB
testcase_07 AC 88 ms
77,212 KB
testcase_08 AC 114 ms
86,276 KB
testcase_09 AC 113 ms
86,344 KB
testcase_10 AC 110 ms
85,304 KB
testcase_11 AC 113 ms
85,492 KB
testcase_12 AC 113 ms
85,704 KB
testcase_13 AC 146 ms
100,072 KB
testcase_14 AC 140 ms
98,788 KB
testcase_15 AC 142 ms
100,208 KB
testcase_16 AC 144 ms
99,176 KB
testcase_17 AC 147 ms
100,000 KB
testcase_18 AC 140 ms
98,924 KB
testcase_19 AC 144 ms
100,152 KB
testcase_20 AC 139 ms
98,140 KB
testcase_21 AC 140 ms
99,336 KB
testcase_22 AC 142 ms
99,868 KB
testcase_23 AC 145 ms
100,492 KB
testcase_24 AC 145 ms
100,544 KB
testcase_25 AC 146 ms
100,604 KB
testcase_26 AC 145 ms
100,664 KB
testcase_27 AC 147 ms
100,372 KB
testcase_28 AC 146 ms
100,568 KB
testcase_29 AC 146 ms
100,708 KB
testcase_30 AC 143 ms
100,568 KB
testcase_31 AC 144 ms
100,376 KB
testcase_32 AC 146 ms
100,736 KB
testcase_33 AC 145 ms
100,696 KB
testcase_34 AC 144 ms
100,548 KB
testcase_35 AC 145 ms
100,776 KB
testcase_36 AC 144 ms
100,700 KB
testcase_37 AC 143 ms
100,628 KB
testcase_38 AC 144 ms
100,812 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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