結果

問題 No.1645 AB's abs
ユーザー aqua_tenhouaqua_tenhou
提出日時 2021-08-13 21:38:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 150 ms / 2,000 ms
コード長 481 bytes
コンパイル時間 459 ms
コンパイル使用メモリ 82,496 KB
実行使用メモリ 97,684 KB
最終ジャッジ日時 2024-04-14 17:09:53
合計ジャッジ時間 6,079 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 50 ms
62,928 KB
testcase_01 AC 46 ms
60,668 KB
testcase_02 AC 65 ms
70,752 KB
testcase_03 AC 45 ms
61,236 KB
testcase_04 AC 48 ms
62,560 KB
testcase_05 AC 51 ms
64,356 KB
testcase_06 AC 54 ms
65,716 KB
testcase_07 AC 50 ms
62,860 KB
testcase_08 AC 70 ms
71,144 KB
testcase_09 AC 70 ms
70,292 KB
testcase_10 AC 67 ms
71,020 KB
testcase_11 AC 67 ms
69,900 KB
testcase_12 AC 68 ms
70,440 KB
testcase_13 AC 147 ms
96,656 KB
testcase_14 AC 135 ms
94,544 KB
testcase_15 AC 146 ms
96,724 KB
testcase_16 AC 141 ms
95,520 KB
testcase_17 AC 144 ms
96,136 KB
testcase_18 AC 140 ms
95,080 KB
testcase_19 AC 147 ms
96,392 KB
testcase_20 AC 137 ms
93,744 KB
testcase_21 AC 142 ms
95,396 KB
testcase_22 AC 143 ms
96,216 KB
testcase_23 AC 146 ms
97,028 KB
testcase_24 AC 144 ms
97,252 KB
testcase_25 AC 146 ms
96,996 KB
testcase_26 AC 145 ms
96,732 KB
testcase_27 AC 145 ms
97,484 KB
testcase_28 AC 145 ms
97,064 KB
testcase_29 AC 142 ms
97,012 KB
testcase_30 AC 146 ms
97,204 KB
testcase_31 AC 149 ms
97,684 KB
testcase_32 AC 146 ms
97,440 KB
testcase_33 AC 150 ms
97,352 KB
testcase_34 AC 149 ms
97,176 KB
testcase_35 AC 148 ms
97,520 KB
testcase_36 AC 147 ms
97,484 KB
testcase_37 AC 149 ms
97,520 KB
testcase_38 AC 141 ms
97,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int,input().split()))

d = [[0 for i in range(2*100*100+1)] for j in range(n+1)]
d[0][100*100] = 1

for i, x in enumerate(a):
    for j in range(2*100*100+1):
        if 0 <= j+x <= 2*100*100:
            d[i+1][j+x] += d[i][j]
        if 0 <= j-x <= 2*100*100:
            d[i+1][j-x] += d[i][j]

ans = 0
mod = 998244353

for i in range(2*100*100+1):
    ans += abs((i-100*100)*d[-1][i])
    ans %= mod
print(ans)
#print(d[-1][100*100-20:100*100+20])
0