結果

問題 No.1645 AB's abs
ユーザー c-yanc-yan
提出日時 2021-08-13 21:45:07
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 534 ms / 2,000 ms
コード長 374 bytes
コンパイル時間 184 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 13,044 KB
最終ジャッジ日時 2024-04-14 17:25:31
合計ジャッジ時間 10,379 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,752 KB
testcase_01 AC 31 ms
10,752 KB
testcase_02 AC 56 ms
11,136 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 29 ms
10,752 KB
testcase_05 AC 29 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 29 ms
10,752 KB
testcase_08 AC 64 ms
11,136 KB
testcase_09 AC 69 ms
11,136 KB
testcase_10 AC 59 ms
11,264 KB
testcase_11 AC 71 ms
11,136 KB
testcase_12 AC 63 ms
11,136 KB
testcase_13 AC 318 ms
12,032 KB
testcase_14 AC 219 ms
11,776 KB
testcase_15 AC 305 ms
11,776 KB
testcase_16 AC 296 ms
11,776 KB
testcase_17 AC 308 ms
11,904 KB
testcase_18 AC 262 ms
11,648 KB
testcase_19 AC 295 ms
11,776 KB
testcase_20 AC 230 ms
11,648 KB
testcase_21 AC 268 ms
11,776 KB
testcase_22 AC 296 ms
11,904 KB
testcase_23 AC 294 ms
11,648 KB
testcase_24 AC 306 ms
11,904 KB
testcase_25 AC 311 ms
12,032 KB
testcase_26 AC 289 ms
12,032 KB
testcase_27 AC 312 ms
11,904 KB
testcase_28 AC 303 ms
12,032 KB
testcase_29 AC 300 ms
11,904 KB
testcase_30 AC 342 ms
12,288 KB
testcase_31 AC 319 ms
11,776 KB
testcase_32 AC 333 ms
12,032 KB
testcase_33 AC 491 ms
12,784 KB
testcase_34 AC 534 ms
12,788 KB
testcase_35 AC 489 ms
12,780 KB
testcase_36 AC 488 ms
12,916 KB
testcase_37 AC 503 ms
13,044 KB
testcase_38 AC 36 ms
10,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

m = 998244353

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

d = {}
d[0] = 1
for a in A:
    t = {}
    for b in d:
        t.setdefault(b + a, 0)
        t[b + a] += d[b]
        t.setdefault(b - a, 0)
        t[b - a] += d[b]
    d = t

result = 0
for b in d:
    if b >= 0:
        result += b * d[b]
    elif b < 0:
        result += -b * d[b]
    result %= m
print(result)
0