結果

問題 No.1825 Except One
ユーザー taiga0629kyoprotaiga0629kyopro
提出日時 2022-03-29 01:11:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 413 ms / 3,000 ms
コード長 586 bytes
コンパイル時間 191 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 194,304 KB
最終ジャッジ日時 2024-04-25 06:09:33
合計ジャッジ時間 7,500 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,808 KB
testcase_01 AC 73 ms
71,808 KB
testcase_02 AC 77 ms
72,960 KB
testcase_03 AC 405 ms
194,176 KB
testcase_04 AC 227 ms
129,024 KB
testcase_05 AC 134 ms
95,744 KB
testcase_06 AC 86 ms
76,800 KB
testcase_07 AC 382 ms
185,344 KB
testcase_08 AC 389 ms
185,600 KB
testcase_09 AC 84 ms
75,776 KB
testcase_10 AC 304 ms
156,800 KB
testcase_11 AC 164 ms
107,008 KB
testcase_12 AC 237 ms
132,224 KB
testcase_13 AC 177 ms
111,872 KB
testcase_14 AC 73 ms
70,656 KB
testcase_15 AC 82 ms
74,496 KB
testcase_16 AC 82 ms
74,880 KB
testcase_17 AC 76 ms
71,808 KB
testcase_18 AC 74 ms
70,784 KB
testcase_19 AC 82 ms
73,856 KB
testcase_20 AC 79 ms
73,856 KB
testcase_21 AC 74 ms
71,808 KB
testcase_22 AC 76 ms
72,448 KB
testcase_23 AC 76 ms
73,088 KB
testcase_24 AC 158 ms
104,576 KB
testcase_25 AC 180 ms
112,128 KB
testcase_26 AC 93 ms
80,384 KB
testcase_27 AC 348 ms
172,672 KB
testcase_28 AC 413 ms
194,304 KB
testcase_29 AC 90 ms
79,104 KB
testcase_30 AC 91 ms
80,256 KB
testcase_31 AC 125 ms
92,672 KB
testcase_32 AC 398 ms
189,440 KB
testcase_33 AC 90 ms
77,824 KB
testcase_34 AC 404 ms
194,176 KB
権限があれば一括ダウンロードができます

ソースコード

diff #


n=int(input())
a=[-1]+list(map(int,input().split()))
a.sort()
ans=0

def f(i,j,s):
    return (i*(n+2)+j)*5050+s

dp=[0]*(n+3)**2*5500

dp[f(0,0,0)]=1

for i in range(n):
    for j in range(i+1):
        for s in range(5001):
            dp[f(i+1,j,s)]+=dp[f(i,j,s)]
            dp[f(i+1,j+1,s+a[i+1])]+=dp[f(i,j,s)]

ans=0
for i in range(2,n+1):
    for j in range(2,i+1):
        for s in range(5001):
            if s%(j-1)!=0:continue
            k=s//(j-1)
            if a[i]>k:continue
            if s-a[i]<0:continue
            ans+=dp[f(i-1,j-1,s-a[i])]


print(ans)






0