結果

問題 No.1645 AB's abs
ユーザー sotanishysotanishy
提出日時 2021-08-14 22:35:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 425 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 71,296 KB
最終ジャッジ日時 2024-04-15 20:02:39
合計ジャッジ時間 3,581 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
52,096 KB
testcase_01 AC 42 ms
51,712 KB
testcase_02 AC 57 ms
62,848 KB
testcase_03 AC 40 ms
52,096 KB
testcase_04 AC 38 ms
52,096 KB
testcase_05 AC 46 ms
58,752 KB
testcase_06 AC 48 ms
59,904 KB
testcase_07 AC 39 ms
51,968 KB
testcase_08 AC 57 ms
63,872 KB
testcase_09 AC 58 ms
63,488 KB
testcase_10 AC 56 ms
63,360 KB
testcase_11 AC 57 ms
63,488 KB
testcase_12 AC 56 ms
63,616 KB
testcase_13 AC 70 ms
70,016 KB
testcase_14 AC 67 ms
69,376 KB
testcase_15 AC 72 ms
70,016 KB
testcase_16 AC 67 ms
69,632 KB
testcase_17 AC 65 ms
70,016 KB
testcase_18 AC 67 ms
69,248 KB
testcase_19 AC 66 ms
70,144 KB
testcase_20 AC 65 ms
68,992 KB
testcase_21 AC 67 ms
69,632 KB
testcase_22 AC 69 ms
69,888 KB
testcase_23 AC 68 ms
70,528 KB
testcase_24 AC 68 ms
70,272 KB
testcase_25 AC 69 ms
70,272 KB
testcase_26 AC 70 ms
70,528 KB
testcase_27 AC 70 ms
70,272 KB
testcase_28 AC 71 ms
70,144 KB
testcase_29 AC 69 ms
70,272 KB
testcase_30 AC 70 ms
70,272 KB
testcase_31 AC 68 ms
70,400 KB
testcase_32 AC 71 ms
70,656 KB
testcase_33 AC 71 ms
70,400 KB
testcase_34 AC 72 ms
71,296 KB
testcase_35 AC 70 ms
70,656 KB
testcase_36 AC 67 ms
70,400 KB
testcase_37 AC 69 ms
70,656 KB
testcase_38 AC 68 ms
70,144 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

mod = 998244353
N = int(input())
A = list(map(int, input().split()))
dp = [0] * (100*N+1)
dp[0] = 1
for a in A:
    ndp = [0] * (100*N+1)
    for i in range(100*N+1):
        if i + a <= 100*N:
            ndp[i+a] = (ndp[i+a] + dp[i]) % mod
        ndp[abs(i-a)] = (ndp[abs(i-a)] + dp[i]) % mod
    dp = ndp
ans = 0
for i in range(100*N+1):
    ans = (ans + dp[i] * i) % mod
print(ans)
0