結果

問題 No.1825 Except One
ユーザー hir355hir355
提出日時 2022-01-28 21:45:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 743 ms / 3,000 ms
コード長 511 bytes
コンパイル時間 801 ms
コンパイル使用メモリ 87,232 KB
実行使用メモリ 180,036 KB
最終ジャッジ日時 2023-08-30 11:05:50
合計ジャッジ時間 11,013 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 93 ms
76,268 KB
testcase_01 AC 93 ms
76,152 KB
testcase_02 AC 96 ms
76,868 KB
testcase_03 AC 732 ms
179,804 KB
testcase_04 AC 298 ms
107,584 KB
testcase_05 AC 154 ms
84,164 KB
testcase_06 AC 104 ms
76,920 KB
testcase_07 AC 662 ms
167,940 KB
testcase_08 AC 667 ms
167,720 KB
testcase_09 AC 102 ms
76,784 KB
testcase_10 AC 468 ms
134,912 KB
testcase_11 AC 197 ms
91,112 KB
testcase_12 AC 320 ms
110,700 KB
testcase_13 AC 214 ms
93,980 KB
testcase_14 AC 83 ms
75,704 KB
testcase_15 AC 106 ms
76,848 KB
testcase_16 AC 106 ms
76,912 KB
testcase_17 AC 91 ms
76,144 KB
testcase_18 AC 82 ms
75,820 KB
testcase_19 AC 104 ms
77,032 KB
testcase_20 AC 102 ms
76,832 KB
testcase_21 AC 91 ms
76,164 KB
testcase_22 AC 101 ms
76,872 KB
testcase_23 AC 100 ms
76,872 KB
testcase_24 AC 189 ms
90,184 KB
testcase_25 AC 216 ms
93,768 KB
testcase_26 AC 122 ms
78,344 KB
testcase_27 AC 573 ms
152,240 KB
testcase_28 AC 743 ms
179,856 KB
testcase_29 AC 112 ms
76,896 KB
testcase_30 AC 127 ms
78,364 KB
testcase_31 AC 152 ms
83,420 KB
testcase_32 AC 710 ms
173,536 KB
testcase_33 AC 111 ms
76,928 KB
testcase_34 AC 731 ms
180,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
a.sort()
M = n * 100
dp = [[[0] * (M + 1) for _ in range(n + 1)] for _ in range(n + 1)]
dp[0][0][0] = 1
ans = 0
for i in range(n):
    for j in range(n + 1):
        for k in range(M + 1):
            if j < n and k + a[i] <= M:
                dp[i + 1][j + 1][k + a[i]] += dp[i][j][k]
                if j >= 1 and (k + a[i]) % j == 0 and a[i] <= (k + a[i]) // j:
                    ans += dp[i][j][k]
            dp[i + 1][j][k] += dp[i][j][k]
print(ans)
0