結果

問題 No.1645 AB's abs
ユーザー Navier_BoltzmannNavier_Boltzmann
提出日時 2021-08-26 23:08:50
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,151 ms / 2,000 ms
コード長 373 bytes
コンパイル時間 143 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 25,728 KB
最終ジャッジ日時 2024-04-29 16:27:17
合計ジャッジ時間 31,590 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 49 ms
11,520 KB
testcase_01 AC 40 ms
11,520 KB
testcase_02 AC 329 ms
13,952 KB
testcase_03 AC 38 ms
11,648 KB
testcase_04 AC 49 ms
11,520 KB
testcase_05 AC 65 ms
11,648 KB
testcase_06 AC 101 ms
11,776 KB
testcase_07 AC 55 ms
11,648 KB
testcase_08 AC 385 ms
14,848 KB
testcase_09 AC 402 ms
14,976 KB
testcase_10 AC 384 ms
14,464 KB
testcase_11 AC 387 ms
14,592 KB
testcase_12 AC 390 ms
14,592 KB
testcase_13 AC 1,060 ms
22,912 KB
testcase_14 AC 961 ms
21,376 KB
testcase_15 AC 1,009 ms
23,040 KB
testcase_16 AC 980 ms
22,528 KB
testcase_17 AC 992 ms
22,912 KB
testcase_18 AC 952 ms
22,016 KB
testcase_19 AC 1,046 ms
22,912 KB
testcase_20 AC 956 ms
21,376 KB
testcase_21 AC 944 ms
22,144 KB
testcase_22 AC 1,010 ms
22,656 KB
testcase_23 AC 1,054 ms
22,912 KB
testcase_24 AC 1,115 ms
23,168 KB
testcase_25 AC 1,088 ms
23,296 KB
testcase_26 AC 1,151 ms
22,912 KB
testcase_27 AC 1,085 ms
23,168 KB
testcase_28 AC 1,049 ms
23,168 KB
testcase_29 AC 1,087 ms
23,168 KB
testcase_30 AC 1,028 ms
23,424 KB
testcase_31 AC 1,026 ms
23,168 KB
testcase_32 AC 1,067 ms
23,424 KB
testcase_33 AC 1,123 ms
25,472 KB
testcase_34 AC 1,078 ms
25,600 KB
testcase_35 AC 1,099 ms
25,600 KB
testcase_36 AC 1,137 ms
25,472 KB
testcase_37 AC 1,068 ms
25,728 KB
testcase_38 AC 1,051 ms
19,456 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int,input().split()))
mod = 998244353
dp = [[0]*N for _ in range(10200)]
dp[A[0]][0] = 2
for i in range(N-1):
  a = A[i+1]
  for j in range(10001):
    dp[abs(j-a)][i+1] += dp[j][i]
    dp[abs(j+a)][i+1] += dp[j][i]
  for j in range(10200):
    dp[j][i+1] %= mod
ans = 0
for i in range(1,10001):
  ans += i*dp[i][N-1]
  ans %= mod
print(ans)  
0