結果

問題 No.1825 Except One
ユーザー 👑 KazunKazun
提出日時 2022-01-28 21:56:51
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 367 ms / 3,000 ms
コード長 372 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 87,244 KB
実行使用メモリ 78,420 KB
最終ジャッジ日時 2023-08-30 11:06:43
合計ジャッジ時間 6,361 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
71,336 KB
testcase_01 AC 77 ms
71,476 KB
testcase_02 AC 75 ms
71,412 KB
testcase_03 AC 228 ms
77,388 KB
testcase_04 AC 139 ms
76,976 KB
testcase_05 AC 107 ms
76,752 KB
testcase_06 AC 98 ms
76,480 KB
testcase_07 AC 224 ms
77,332 KB
testcase_08 AC 230 ms
77,240 KB
testcase_09 AC 96 ms
76,216 KB
testcase_10 AC 167 ms
77,144 KB
testcase_11 AC 106 ms
76,776 KB
testcase_12 AC 143 ms
77,000 KB
testcase_13 AC 122 ms
76,956 KB
testcase_14 AC 77 ms
71,476 KB
testcase_15 AC 92 ms
76,140 KB
testcase_16 AC 93 ms
76,200 KB
testcase_17 AC 75 ms
71,428 KB
testcase_18 AC 76 ms
71,332 KB
testcase_19 AC 86 ms
76,084 KB
testcase_20 AC 85 ms
75,960 KB
testcase_21 AC 80 ms
75,740 KB
testcase_22 AC 80 ms
76,080 KB
testcase_23 AC 84 ms
76,096 KB
testcase_24 AC 118 ms
77,180 KB
testcase_25 AC 109 ms
76,668 KB
testcase_26 AC 99 ms
76,220 KB
testcase_27 AC 182 ms
77,012 KB
testcase_28 AC 320 ms
76,968 KB
testcase_29 AC 101 ms
76,208 KB
testcase_30 AC 106 ms
76,912 KB
testcase_31 AC 103 ms
76,588 KB
testcase_32 AC 239 ms
78,420 KB
testcase_33 AC 102 ms
76,152 KB
testcase_34 AC 367 ms
77,180 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

A_sum=sum(A)
DP=[[0]*(A_sum+1) for _ in range(N+1)]
DP[0][0]=1

A.sort()
Ans=0
for p,a in enumerate(A,1):
    for n in range(N,0,-1):
        D=DP[n]
        E=DP[n-1]
        for s in range(A_sum,a-1,-1):
            D[s]+=E[s-a]

            if n>=2 and s>=(n-1)*a and s%(n-1)==0:
                Ans+=E[s-a]

print(Ans)
0