結果

問題 No.1645 AB's abs
ユーザー ShirotsumeShirotsume
提出日時 2021-08-13 21:51:37
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,726 ms / 2,000 ms
コード長 377 bytes
コンパイル時間 270 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 78,976 KB
最終ジャッジ日時 2024-04-14 17:39:37
合計ジャッジ時間 47,750 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 141 ms
62,592 KB
testcase_01 AC 132 ms
62,592 KB
testcase_02 AC 540 ms
62,976 KB
testcase_03 AC 126 ms
62,592 KB
testcase_04 AC 141 ms
62,592 KB
testcase_05 AC 177 ms
62,592 KB
testcase_06 AC 236 ms
62,592 KB
testcase_07 AC 156 ms
62,592 KB
testcase_08 AC 710 ms
63,360 KB
testcase_09 AC 671 ms
63,488 KB
testcase_10 AC 612 ms
63,104 KB
testcase_11 AC 610 ms
63,360 KB
testcase_12 AC 645 ms
63,488 KB
testcase_13 AC 1,527 ms
72,448 KB
testcase_14 AC 1,462 ms
69,504 KB
testcase_15 AC 1,575 ms
72,704 KB
testcase_16 AC 1,624 ms
72,064 KB
testcase_17 AC 1,500 ms
72,320 KB
testcase_18 AC 1,432 ms
70,784 KB
testcase_19 AC 1,586 ms
72,064 KB
testcase_20 AC 1,429 ms
69,760 KB
testcase_21 AC 1,553 ms
71,040 KB
testcase_22 AC 1,553 ms
72,192 KB
testcase_23 AC 1,656 ms
71,808 KB
testcase_24 AC 1,689 ms
72,576 KB
testcase_25 AC 1,617 ms
72,960 KB
testcase_26 AC 1,726 ms
72,192 KB
testcase_27 AC 1,543 ms
72,832 KB
testcase_28 AC 1,542 ms
72,704 KB
testcase_29 AC 1,548 ms
72,576 KB
testcase_30 AC 1,612 ms
73,344 KB
testcase_31 AC 1,664 ms
73,088 KB
testcase_32 AC 1,555 ms
73,344 KB
testcase_33 AC 1,594 ms
78,720 KB
testcase_34 AC 1,586 ms
78,848 KB
testcase_35 AC 1,681 ms
78,848 KB
testcase_36 AC 1,664 ms
78,848 KB
testcase_37 AC 1,602 ms
78,976 KB
testcase_38 AC 1,517 ms
62,848 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

dp = [[0] * 60000 for _ in range(110)]
dp[0][0] = 1
n = int(input())
a = list(map(int,input().split()))
mod = 998244353
for i in range(n):
    for j in range(-10010, 10010):
        dp[i + 1][j + a[i]] += dp[i][j]
        dp[i + 1][j - a[i]] += dp[i][j]
        dp[i + 1][j] %= mod
ans = 0

for j in range(-10010, 10010):
    ans += abs(j) * dp[n][j]
    ans %= mod
print(ans)
0