結果

問題 No.1645 AB's abs
ユーザー c-yanc-yan
提出日時 2021-08-14 00:45:58
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 420 ms / 2,000 ms
コード長 300 bytes
コンパイル時間 165 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 12,900 KB
最終ジャッジ日時 2024-04-14 22:14:26
合計ジャッジ時間 9,124 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 28 ms
10,624 KB
testcase_02 AC 48 ms
11,136 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 29 ms
10,880 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 30 ms
10,752 KB
testcase_08 AC 59 ms
11,136 KB
testcase_09 AC 65 ms
11,264 KB
testcase_10 AC 57 ms
11,136 KB
testcase_11 AC 59 ms
11,136 KB
testcase_12 AC 59 ms
11,136 KB
testcase_13 AC 257 ms
11,904 KB
testcase_14 AC 189 ms
11,776 KB
testcase_15 AC 260 ms
11,904 KB
testcase_16 AC 251 ms
11,904 KB
testcase_17 AC 261 ms
11,904 KB
testcase_18 AC 221 ms
11,776 KB
testcase_19 AC 249 ms
11,904 KB
testcase_20 AC 197 ms
11,776 KB
testcase_21 AC 219 ms
11,776 KB
testcase_22 AC 248 ms
11,904 KB
testcase_23 AC 240 ms
11,776 KB
testcase_24 AC 252 ms
11,776 KB
testcase_25 AC 268 ms
11,904 KB
testcase_26 AC 245 ms
11,776 KB
testcase_27 AC 258 ms
11,904 KB
testcase_28 AC 251 ms
11,904 KB
testcase_29 AC 260 ms
11,776 KB
testcase_30 AC 290 ms
12,160 KB
testcase_31 AC 272 ms
11,904 KB
testcase_32 AC 277 ms
11,904 KB
testcase_33 AC 420 ms
12,768 KB
testcase_34 AC 408 ms
12,772 KB
testcase_35 AC 417 ms
12,892 KB
testcase_36 AC 407 ms
12,772 KB
testcase_37 AC 414 ms
12,900 KB
testcase_38 AC 35 ms
10,752 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

m = 998244353

N, *A = map(int, open(0).read().split())

d = {0: 1}
for a in A:
    t = defaultdict(int)
    for k in d:
        t[k + a] += d[k]
        t[k - a] += d[k]
    d = t

result = 0
for k in d:
    result += abs(k) * d[k]
    result %= m
print(result)
0