結果

問題 No.1645 AB's abs
ユーザー H3PO4H3PO4
提出日時 2021-08-13 21:31:39
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 590 ms / 2,000 ms
コード長 365 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 44,580 KB
最終ジャッジ日時 2024-04-14 16:50:26
合計ジャッジ時間 25,765 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 528 ms
44,196 KB
testcase_01 AC 541 ms
44,192 KB
testcase_02 AC 553 ms
44,188 KB
testcase_03 AC 552 ms
44,320 KB
testcase_04 AC 545 ms
43,812 KB
testcase_05 AC 546 ms
44,188 KB
testcase_06 AC 541 ms
44,456 KB
testcase_07 AC 535 ms
44,460 KB
testcase_08 AC 565 ms
44,204 KB
testcase_09 AC 580 ms
44,068 KB
testcase_10 AC 581 ms
44,580 KB
testcase_11 AC 576 ms
44,328 KB
testcase_12 AC 554 ms
44,064 KB
testcase_13 AC 584 ms
44,320 KB
testcase_14 AC 565 ms
43,944 KB
testcase_15 AC 590 ms
44,204 KB
testcase_16 AC 578 ms
44,320 KB
testcase_17 AC 573 ms
43,812 KB
testcase_18 AC 560 ms
44,328 KB
testcase_19 AC 555 ms
43,816 KB
testcase_20 AC 562 ms
43,908 KB
testcase_21 AC 553 ms
43,932 KB
testcase_22 AC 571 ms
44,296 KB
testcase_23 AC 559 ms
44,060 KB
testcase_24 AC 559 ms
44,200 KB
testcase_25 AC 555 ms
44,448 KB
testcase_26 AC 563 ms
44,192 KB
testcase_27 AC 564 ms
43,940 KB
testcase_28 AC 559 ms
44,456 KB
testcase_29 AC 567 ms
44,068 KB
testcase_30 AC 563 ms
43,812 KB
testcase_31 AC 562 ms
44,320 KB
testcase_32 AC 566 ms
43,940 KB
testcase_33 AC 557 ms
43,944 KB
testcase_34 AC 566 ms
44,292 KB
testcase_35 AC 555 ms
43,816 KB
testcase_36 AC 560 ms
44,072 KB
testcase_37 AC 555 ms
44,316 KB
testcase_38 AC 559 ms
44,068 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np

N = int(input())
A = map(int, input().split())
MOD = 998244353
MAX = 10000
dp = np.zeros(2 * MAX + 1, dtype=np.int64)
dp[MAX] = 1
for a in A:
    new_dp = np.zeros(2 * MAX + 1, dtype=np.int64)
    new_dp[a:] += dp[:-a]
    new_dp[:-a] += dp[a:]
    dp = new_dp
    dp %= MOD
dp *= np.abs(np.arange(-MAX, MAX + 1))
dp %= MOD
print(dp.sum() % MOD)
0