結果

問題 No.1645 AB's abs
ユーザー ProgrammerryokiProgrammerryoki
提出日時 2021-08-13 21:36:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 611 ms / 2,000 ms
コード長 412 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 43,392 KB
最終ジャッジ日時 2024-04-14 17:05:06
合計ジャッジ時間 14,717 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,880 KB
testcase_01 AC 29 ms
10,752 KB
testcase_02 AC 70 ms
12,544 KB
testcase_03 AC 29 ms
10,752 KB
testcase_04 AC 30 ms
10,752 KB
testcase_05 AC 30 ms
10,752 KB
testcase_06 AC 32 ms
11,008 KB
testcase_07 AC 30 ms
10,880 KB
testcase_08 AC 94 ms
13,952 KB
testcase_09 AC 98 ms
13,952 KB
testcase_10 AC 85 ms
13,184 KB
testcase_11 AC 86 ms
13,312 KB
testcase_12 AC 85 ms
13,440 KB
testcase_13 AC 468 ms
36,096 KB
testcase_14 AC 381 ms
31,104 KB
testcase_15 AC 486 ms
36,352 KB
testcase_16 AC 427 ms
34,304 KB
testcase_17 AC 441 ms
35,456 KB
testcase_18 AC 412 ms
32,896 KB
testcase_19 AC 470 ms
35,712 KB
testcase_20 AC 372 ms
31,104 KB
testcase_21 AC 412 ms
33,280 KB
testcase_22 AC 444 ms
35,456 KB
testcase_23 AC 454 ms
36,224 KB
testcase_24 AC 513 ms
36,992 KB
testcase_25 AC 473 ms
37,248 KB
testcase_26 AC 454 ms
36,608 KB
testcase_27 AC 467 ms
37,120 KB
testcase_28 AC 467 ms
36,864 KB
testcase_29 AC 486 ms
36,864 KB
testcase_30 AC 469 ms
37,760 KB
testcase_31 AC 482 ms
37,376 KB
testcase_32 AC 482 ms
37,632 KB
testcase_33 AC 559 ms
43,136 KB
testcase_34 AC 561 ms
43,264 KB
testcase_35 AC 611 ms
43,264 KB
testcase_36 AC 587 ms
43,264 KB
testcase_37 AC 595 ms
43,392 KB
testcase_38 AC 329 ms
27,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353

N = int(input())
A = [int(i) for i in input().split()]
r = 100*N
w = r*2
dp = [[0]*(w+1) for i in range(N+1)]
dp[0][r] = 1
for i in range(N):
    num = A[i]
    for j in range(w+1):
        if dp[i][j] == 0:
            continue
        dp[i+1][j+num] += dp[i][j]
        dp[i+1][j-num] += dp[i][j]
total = 0
for i in range(w+1):
    total += abs(dp[-1][i] * (i-r))
    total %= MOD
print(total)
0