結果

問題 No.1645 AB's abs
ユーザー 👑 KazunKazun
提出日時 2021-08-13 21:28:28
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 140 ms / 2,000 ms
コード長 321 bytes
コンパイル時間 225 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 79,652 KB
最終ジャッジ日時 2024-04-14 16:44:02
合計ジャッジ時間 4,837 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
54,028 KB
testcase_01 AC 38 ms
53,524 KB
testcase_02 AC 61 ms
70,724 KB
testcase_03 AC 38 ms
54,228 KB
testcase_04 AC 38 ms
53,668 KB
testcase_05 AC 38 ms
53,748 KB
testcase_06 AC 39 ms
55,048 KB
testcase_07 AC 39 ms
54,300 KB
testcase_08 AC 63 ms
73,516 KB
testcase_09 AC 63 ms
73,400 KB
testcase_10 AC 64 ms
71,380 KB
testcase_11 AC 63 ms
72,820 KB
testcase_12 AC 63 ms
72,160 KB
testcase_13 AC 110 ms
76,756 KB
testcase_14 AC 96 ms
76,656 KB
testcase_15 AC 111 ms
76,816 KB
testcase_16 AC 107 ms
76,696 KB
testcase_17 AC 106 ms
76,676 KB
testcase_18 AC 104 ms
76,568 KB
testcase_19 AC 103 ms
76,652 KB
testcase_20 AC 97 ms
76,548 KB
testcase_21 AC 99 ms
76,496 KB
testcase_22 AC 108 ms
76,648 KB
testcase_23 AC 105 ms
76,744 KB
testcase_24 AC 110 ms
76,580 KB
testcase_25 AC 115 ms
76,920 KB
testcase_26 AC 103 ms
76,764 KB
testcase_27 AC 107 ms
76,752 KB
testcase_28 AC 110 ms
76,572 KB
testcase_29 AC 110 ms
76,636 KB
testcase_30 AC 111 ms
76,576 KB
testcase_31 AC 110 ms
76,904 KB
testcase_32 AC 111 ms
77,612 KB
testcase_33 AC 139 ms
79,652 KB
testcase_34 AC 133 ms
79,088 KB
testcase_35 AC 133 ms
79,396 KB
testcase_36 AC 139 ms
79,488 KB
testcase_37 AC 140 ms
79,600 KB
testcase_38 AC 50 ms
63,704 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

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

D=defaultdict(int); D[0]=1
for a in A:
    E=D
    D=defaultdict(int)

    for x in E:
        D[x+a]+=E[x]
        D[x-a]+=E[x]

    for x in D:
        D[x]%=Mod

Y=0
for x in D:
    Y+=abs(x)*D[x]
    Y%=Mod

print(Y)
0