結果

問題 No.1825 Except One
ユーザー roarisroaris
提出日時 2022-02-13 21:49:21
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 588 ms / 3,000 ms
コード長 514 bytes
コンパイル時間 276 ms
コンパイル使用メモリ 86,668 KB
実行使用メモリ 99,252 KB
最終ジャッジ日時 2023-09-11 15:43:33
合計ジャッジ時間 9,118 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
75,560 KB
testcase_01 AC 76 ms
75,956 KB
testcase_02 AC 82 ms
75,888 KB
testcase_03 AC 586 ms
99,252 KB
testcase_04 AC 236 ms
82,064 KB
testcase_05 AC 128 ms
77,860 KB
testcase_06 AC 88 ms
75,732 KB
testcase_07 AC 525 ms
94,612 KB
testcase_08 AC 525 ms
94,944 KB
testcase_09 AC 87 ms
75,744 KB
testcase_10 AC 368 ms
86,232 KB
testcase_11 AC 161 ms
78,972 KB
testcase_12 AC 250 ms
81,964 KB
testcase_13 AC 170 ms
78,688 KB
testcase_14 AC 69 ms
71,148 KB
testcase_15 AC 85 ms
75,644 KB
testcase_16 AC 84 ms
75,632 KB
testcase_17 AC 76 ms
75,624 KB
testcase_18 AC 69 ms
70,844 KB
testcase_19 AC 83 ms
75,612 KB
testcase_20 AC 84 ms
75,908 KB
testcase_21 AC 77 ms
75,548 KB
testcase_22 AC 83 ms
76,116 KB
testcase_23 AC 87 ms
76,004 KB
testcase_24 AC 154 ms
77,900 KB
testcase_25 AC 177 ms
78,440 KB
testcase_26 AC 96 ms
76,624 KB
testcase_27 AC 451 ms
90,416 KB
testcase_28 AC 588 ms
97,980 KB
testcase_29 AC 90 ms
76,272 KB
testcase_30 AC 99 ms
76,420 KB
testcase_31 AC 122 ms
77,468 KB
testcase_32 AC 552 ms
97,376 KB
testcase_33 AC 88 ms
75,996 KB
testcase_34 AC 584 ms
97,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())
A = list(map(int, input().split()))
A.sort()
dp = [[0]*(N*100+1) for _ in range(N+1)]
dp[0][0] = 1
ans = 0

for i in range(N):
    ndp = [[0]*(N*100+1) for _ in range(N+1)]
    
    for j in range(N):
        for k in range(N*100):
            ndp[j][k] += dp[j][k]

            if k+A[i]<=N*100:
                ndp[j+1][k+A[i]] += dp[j][k]
                
                if j>=1 and (k+A[i])%j==0 and A[i]<=(k+A[i])//j:
                    ans += ndp[j+1][k+A[i]]
    
    dp = ndp

print(ans)
0