結果

問題 No.1645 AB's abs
ユーザー c-yanc-yan
提出日時 2021-08-14 01:03:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 694 ms / 2,000 ms
コード長 344 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 12,772 KB
最終ジャッジ日時 2024-04-14 22:31:52
合計ジャッジ時間 13,466 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
10,880 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 59 ms
11,136 KB
testcase_03 AC 30 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 30 ms
10,752 KB
testcase_07 AC 31 ms
10,752 KB
testcase_08 AC 78 ms
11,008 KB
testcase_09 AC 85 ms
11,136 KB
testcase_10 AC 69 ms
11,008 KB
testcase_11 AC 78 ms
11,008 KB
testcase_12 AC 75 ms
11,136 KB
testcase_13 AC 415 ms
11,648 KB
testcase_14 AC 286 ms
11,500 KB
testcase_15 AC 426 ms
11,776 KB
testcase_16 AC 399 ms
11,756 KB
testcase_17 AC 392 ms
11,752 KB
testcase_18 AC 346 ms
11,648 KB
testcase_19 AC 394 ms
11,776 KB
testcase_20 AC 305 ms
11,648 KB
testcase_21 AC 351 ms
11,648 KB
testcase_22 AC 393 ms
11,776 KB
testcase_23 AC 375 ms
11,648 KB
testcase_24 AC 400 ms
11,756 KB
testcase_25 AC 418 ms
11,776 KB
testcase_26 AC 390 ms
11,648 KB
testcase_27 AC 414 ms
11,776 KB
testcase_28 AC 409 ms
11,776 KB
testcase_29 AC 412 ms
11,648 KB
testcase_30 AC 448 ms
12,032 KB
testcase_31 AC 425 ms
11,752 KB
testcase_32 AC 446 ms
11,904 KB
testcase_33 AC 662 ms
12,640 KB
testcase_34 AC 661 ms
12,640 KB
testcase_35 AC 694 ms
12,636 KB
testcase_36 AC 669 ms
12,636 KB
testcase_37 AC 676 ms
12,772 KB
testcase_38 AC 37 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] %= m
        t[k - a] += d[k]
        t[k - a] %= m
    d = t

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