結果

問題 No.1645 AB's abs
ユーザー convexineqconvexineq
提出日時 2021-08-13 21:32:39
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 57 ms / 2,000 ms
コード長 296 bytes
コンパイル時間 161 ms
コンパイル使用メモリ 82,388 KB
実行使用メモリ 61,804 KB
最終ジャッジ日時 2024-04-14 16:52:13
合計ジャッジ時間 3,287 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,888 KB
testcase_01 AC 36 ms
53,628 KB
testcase_02 AC 46 ms
59,972 KB
testcase_03 AC 35 ms
52,828 KB
testcase_04 AC 36 ms
52,340 KB
testcase_05 AC 40 ms
59,432 KB
testcase_06 AC 42 ms
59,704 KB
testcase_07 AC 40 ms
59,632 KB
testcase_08 AC 47 ms
61,540 KB
testcase_09 AC 46 ms
60,904 KB
testcase_10 AC 45 ms
61,720 KB
testcase_11 AC 47 ms
59,876 KB
testcase_12 AC 46 ms
61,312 KB
testcase_13 AC 55 ms
60,732 KB
testcase_14 AC 54 ms
60,344 KB
testcase_15 AC 55 ms
60,340 KB
testcase_16 AC 53 ms
60,604 KB
testcase_17 AC 55 ms
60,620 KB
testcase_18 AC 54 ms
60,524 KB
testcase_19 AC 55 ms
60,484 KB
testcase_20 AC 54 ms
60,556 KB
testcase_21 AC 53 ms
61,380 KB
testcase_22 AC 55 ms
61,656 KB
testcase_23 AC 55 ms
60,396 KB
testcase_24 AC 56 ms
61,292 KB
testcase_25 AC 56 ms
61,316 KB
testcase_26 AC 56 ms
61,192 KB
testcase_27 AC 56 ms
60,444 KB
testcase_28 AC 56 ms
60,872 KB
testcase_29 AC 56 ms
60,348 KB
testcase_30 AC 56 ms
60,036 KB
testcase_31 AC 56 ms
60,464 KB
testcase_32 AC 56 ms
61,276 KB
testcase_33 AC 56 ms
60,484 KB
testcase_34 AC 57 ms
61,076 KB
testcase_35 AC 55 ms
61,288 KB
testcase_36 AC 56 ms
60,668 KB
testcase_37 AC 56 ms
61,480 KB
testcase_38 AC 55 ms
61,804 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
n = int(input())
*a, = map(int,input().split())
M = n*200+1
dp = [0]*M
dp[0] = 1
for ai in a:
    ai *= 2
    for i in range(ai,M)[::-1]:
        dp[i] += dp[i-ai]
        dp[i] %= MOD
offset = sum(a)
ans = 0
for i,v in enumerate(dp):
    ans += abs(i-offset)*v%MOD
print(ans%MOD)
0