結果

問題 No.1825 Except One
ユーザー kozykozy
提出日時 2022-01-28 21:56:54
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 670 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 86,636 KB
実行使用メモリ 846,424 KB
最終ジャッジ日時 2023-08-28 19:52:30
合計ジャッジ時間 3,198 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,284 KB
testcase_01 AC 74 ms
71,416 KB
testcase_02 AC 72 ms
70,920 KB
testcase_03 MLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

N=int(input())
A=list(map(int,input().split()))
dp=[[[[0]*(sum(A)+1) for i in range(max(A)+1)] for k in range(N+1)] for s in range(N)]
dp[0][1][A[0]][A[0]]=1
dp[0][0][0][0]=1
mm=max(A)
ss=sum(A)
ans=0
for i in range(1,N):
  for j in range(N+1):
    for s in range(ss+1):
      if s>=A[i] and j>=1:
        for d in range(A[i]+1):
          dp[i][j][A[i]][s]+=dp[i-1][j-1][d][s-A[i]]
        for d in range(A[i]+1,mm+1):
          dp[i][j][d][s]+=dp[i-1][j-1][d][s-A[i]]
        
      for k in range(mm+1):
        dp[i][j][k][s]+=dp[i-1][j][k][s]
        
        if i==N-1 and j>=2:
          if (s%(j-1)==0 and k<=s//(j-1)):
            ans+=dp[i][j][k][s]
print(ans)
0