結果
| 問題 |
No.1825 Except One
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-01 21:47:27 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 537 bytes |
| コンパイル時間 | 1,771 ms |
| コンパイル使用メモリ | 173,320 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-11 09:14:22 |
| 合計ジャッジ時間 | 2,939 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 WA * 2 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int N;
cin>>N;
vector<int>A(N);
for(int &i:A)cin>>i;
sort(A.begin(),A.end());
vector<vector<int>>dp(N+1,vector<int>(N*100+1));
dp[0][0]=1;
int ans=0;
for(int i=0;i<N;i++){
for(int j=N;j>1;j--){
for(int k=N*100;k>=A[i];k--){
dp[j][k]+=dp[j-1][k-A[i]];
if(k%(j-1)==0&&k/(j-1)>=A[i]){
ans+=dp[j-1][k-A[i]];
}
}
}
dp[1][A[i]]+=1;
}
cout<<ans<<'\n';
}