結果

問題 No.1645 AB's abs
ユーザー shinichishinichi
提出日時 2021-08-19 18:55:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 148 ms / 2,000 ms
コード長 386 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 96,800 KB
最終ジャッジ日時 2024-04-20 21:40:00
合計ジャッジ時間 5,663 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 36 ms
52,224 KB
testcase_01 AC 35 ms
52,096 KB
testcase_02 AC 59 ms
66,432 KB
testcase_03 AC 36 ms
51,840 KB
testcase_04 AC 40 ms
51,968 KB
testcase_05 AC 44 ms
58,240 KB
testcase_06 AC 48 ms
60,032 KB
testcase_07 AC 42 ms
57,984 KB
testcase_08 AC 65 ms
67,584 KB
testcase_09 AC 63 ms
67,840 KB
testcase_10 AC 61 ms
66,944 KB
testcase_11 AC 64 ms
66,944 KB
testcase_12 AC 69 ms
67,200 KB
testcase_13 AC 139 ms
95,616 KB
testcase_14 AC 123 ms
92,196 KB
testcase_15 AC 133 ms
95,368 KB
testcase_16 AC 129 ms
93,644 KB
testcase_17 AC 133 ms
94,684 KB
testcase_18 AC 127 ms
92,964 KB
testcase_19 AC 139 ms
95,280 KB
testcase_20 AC 123 ms
91,584 KB
testcase_21 AC 129 ms
93,412 KB
testcase_22 AC 135 ms
94,968 KB
testcase_23 AC 137 ms
95,984 KB
testcase_24 AC 136 ms
96,676 KB
testcase_25 AC 137 ms
96,604 KB
testcase_26 AC 135 ms
96,036 KB
testcase_27 AC 137 ms
96,104 KB
testcase_28 AC 134 ms
96,260 KB
testcase_29 AC 136 ms
96,276 KB
testcase_30 AC 138 ms
96,232 KB
testcase_31 AC 148 ms
96,056 KB
testcase_32 AC 141 ms
96,180 KB
testcase_33 AC 141 ms
96,496 KB
testcase_34 AC 137 ms
96,800 KB
testcase_35 AC 141 ms
96,628 KB
testcase_36 AC 140 ms
96,756 KB
testcase_37 AC 147 ms
96,608 KB
testcase_38 AC 105 ms
91,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))

dp = [[0] * (100 * N * 2 + 1) for _ in range(N+1)]
dp[0][0] = 1

for i in range(N):
    for j in range(-100*N, 100*N+1):
        if dp[i][j]:
            dp[i+1][j+A[i]] += dp[i][j]
            dp[i+1][j-A[i]] += dp[i][j]
ans = 0
MOD = 998244353
for j in range(-100*N, 100*N+1):
    ans += abs(j*dp[-1][j])
    ans %= MOD
print(ans)
0