結果

問題 No.1645 AB's abs
ユーザー lllllll88938494lllllll88938494
提出日時 2022-05-30 17:50:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 79 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 349 ms
コンパイル使用メモリ 81,836 KB
実行使用メモリ 77,788 KB
最終ジャッジ日時 2023-10-21 00:22:35
合計ジャッジ時間 4,545 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 48 ms
60,268 KB
testcase_01 AC 46 ms
60,100 KB
testcase_02 AC 57 ms
66,840 KB
testcase_03 AC 45 ms
60,100 KB
testcase_04 AC 48 ms
60,268 KB
testcase_05 AC 47 ms
60,580 KB
testcase_06 AC 50 ms
63,388 KB
testcase_07 AC 47 ms
60,424 KB
testcase_08 AC 58 ms
68,248 KB
testcase_09 AC 59 ms
68,248 KB
testcase_10 AC 58 ms
67,620 KB
testcase_11 AC 58 ms
67,620 KB
testcase_12 AC 58 ms
67,780 KB
testcase_13 AC 76 ms
77,476 KB
testcase_14 AC 73 ms
76,540 KB
testcase_15 AC 75 ms
77,476 KB
testcase_16 AC 75 ms
76,852 KB
testcase_17 AC 76 ms
77,320 KB
testcase_18 AC 74 ms
76,696 KB
testcase_19 AC 76 ms
77,476 KB
testcase_20 AC 73 ms
76,224 KB
testcase_21 AC 74 ms
76,852 KB
testcase_22 AC 75 ms
77,320 KB
testcase_23 AC 75 ms
77,788 KB
testcase_24 AC 76 ms
77,788 KB
testcase_25 AC 76 ms
77,788 KB
testcase_26 AC 76 ms
77,788 KB
testcase_27 AC 76 ms
77,788 KB
testcase_28 AC 76 ms
77,788 KB
testcase_29 AC 77 ms
77,788 KB
testcase_30 AC 77 ms
77,788 KB
testcase_31 AC 76 ms
77,788 KB
testcase_32 AC 77 ms
77,788 KB
testcase_33 AC 79 ms
77,772 KB
testcase_34 AC 78 ms
77,772 KB
testcase_35 AC 78 ms
77,772 KB
testcase_36 AC 78 ms
77,772 KB
testcase_37 AC 78 ms
77,772 KB
testcase_38 AC 71 ms
77,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
a=list(map(int,input().split()))
mod=998244353
dp=[[0]*20001 for i in range(n+1)]
dp[0][10000]=1

for i in range(n):
    for j in range(20001):
        if dp[i][j] == 0:
            continue
        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(len(dp[-1])):
    ans+= abs(i - 10000)*dp[-1][i]
    
print(ans%mod)
0