結果

問題 No.1825 Except One
ユーザー gr1msl3ygr1msl3y
提出日時 2022-01-29 02:36:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 540 ms / 3,000 ms
コード長 492 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 86,892 KB
実行使用メモリ 200,744 KB
最終ジャッジ日時 2023-08-30 11:13:42
合計ジャッジ時間 7,263 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,392 KB
testcase_01 AC 71 ms
71,276 KB
testcase_02 AC 73 ms
71,344 KB
testcase_03 AC 278 ms
133,956 KB
testcase_04 AC 144 ms
90,908 KB
testcase_05 AC 112 ms
82,584 KB
testcase_06 AC 94 ms
77,168 KB
testcase_07 AC 264 ms
133,828 KB
testcase_08 AC 274 ms
134,048 KB
testcase_09 AC 90 ms
76,564 KB
testcase_10 AC 223 ms
113,384 KB
testcase_11 AC 110 ms
84,700 KB
testcase_12 AC 153 ms
90,432 KB
testcase_13 AC 125 ms
88,472 KB
testcase_14 AC 71 ms
71,220 KB
testcase_15 AC 89 ms
76,656 KB
testcase_16 AC 92 ms
76,628 KB
testcase_17 AC 73 ms
71,136 KB
testcase_18 AC 73 ms
71,280 KB
testcase_19 AC 86 ms
76,600 KB
testcase_20 AC 84 ms
76,612 KB
testcase_21 AC 80 ms
76,088 KB
testcase_22 AC 79 ms
76,456 KB
testcase_23 AC 87 ms
76,696 KB
testcase_24 AC 128 ms
87,012 KB
testcase_25 AC 100 ms
76,900 KB
testcase_26 AC 90 ms
76,612 KB
testcase_27 AC 223 ms
113,540 KB
testcase_28 AC 446 ms
182,232 KB
testcase_29 AC 102 ms
76,792 KB
testcase_30 AC 107 ms
78,724 KB
testcase_31 AC 113 ms
82,048 KB
testcase_32 AC 318 ms
146,544 KB
testcase_33 AC 95 ms
77,328 KB
testcase_34 AC 540 ms
200,744 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
A.sort()
M = sum(A)

dp = [[[0]*(N+1) for _ in range(M+1)] for i in range(N+1)]
dp[0][0][0] = 1
ans = 0

for i in range(N):
    a = A[i]
    for j in range(M+1):
        dp[i+1][j][0] = dp[i][j][0]
        for k in range(i+1):
            v = 0
            if j >= a:
                v = dp[i][j-a][k]
                if k and j % k == 0 and a*k <= j:
                    ans += v
            dp[i+1][j][k+1] = dp[i][j][k+1]+v

print(ans)
0