結果

問題 No.1645 AB's abs
ユーザー umaruuuunumaruuuun
提出日時 2021-08-20 15:13:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 371 bytes
コンパイル時間 333 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 41,500 KB
最終ジャッジ日時 2024-04-21 19:33:55
合計ジャッジ時間 40,144 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
11,136 KB
testcase_01 AC 67 ms
10,880 KB
testcase_02 AC 725 ms
16,000 KB
testcase_03 AC 68 ms
10,880 KB
testcase_04 AC 88 ms
11,136 KB
testcase_05 AC 134 ms
11,520 KB
testcase_06 AC 226 ms
12,032 KB
testcase_07 AC 113 ms
11,264 KB
testcase_08 AC 992 ms
17,664 KB
testcase_09 AC 912 ms
17,920 KB
testcase_10 AC 869 ms
16,896 KB
testcase_11 AC 861 ms
17,024 KB
testcase_12 AC 909 ms
17,152 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 TLE -
testcase_26 TLE -
testcase_27 TLE -
testcase_28 TLE -
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 TLE -
testcase_34 TLE -
testcase_35 TLE -
testcase_36 TLE -
testcase_37 TLE -
testcase_38 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

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