// アイスクリーム
#include <bits/stdc++.h>
#ifndef alks
#pragma GCC target("avx2,bmi,bmi2,popcnt,lzcnt")
#endif
#pragma GCC optimize("O3,unroll-loops")
#define ll long long
#define int ll
#define Yes cout<<"YES\n"; return;
#define No cout<<"NO\n"; return;
#define yes cout<<"Yes\n"; return;
#define no cout<<"No\n"; return;
#define wrans cout<<"-1\n"; return;
using namespace std;
const int N=1e6+100;
const int M=1e6+100;
const int mod1=998244353;
const int mod=1e9+7;
const int INF=1e18;
const long double eps=1e-12;
const string ab="abcdefghijklmnopqrstuvwxyz";
const string AB="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
int n;
int a[N];
bool dp[N];
void alikosh(){
cin>>n;
int sum=0;
for(int i=1;i<=n;i++){
cin>>a[i];
sum+=a[i];
}
set <int> st;
for(int i=1;i<=500;i++){
int x=sum+i;
for(int j=1;j<=x;j++){
dp[j]=0;
}
dp[0]=1;
for(int j=1;j<=n;j++){
for(int s=x;s>=a[j];s--){
if(dp[s-a[j]]){
dp[s]=1;
}
}
}
for(int j=1;j<=n;j++){
int z=x-a[j];
if(z%2==0 && dp[z/2]){
st.insert(i);
break;
}
}
}
cout<<st.size()<<"\n";
for(auto it:st){
cout<<it<<" ";
}
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int alikosh1=1;
// cin>>alikosh1;
for(int i=1;i<=alikosh1;i++){
// cout<<"Case "<<i<<": ";
alikosh();
}
}
//, Ice \ \
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |