#include <bits/stdc++.h>
#define MAX 251000
typedef std::bitset<MAX> bits;
int main()
{
int N;
std::cin>>N;
int array[N];for(auto&x:array)std::cin>>x;
int t=0;
{
for(auto&x:array)t+=x;
if(t&1){
std::cout<<"0\n";
return 0;
}
bits x = {};
x[0]=1;
for(int i=0;i!=N;++i){
x|=x<<array[i];
}
if(!x[t/2]){
std::cout<<"0\n";
return 0;
}
}
bits permite={};
for(int i=0;i!=MAX;++i)permite[i]=1;
for(int i=0;i!=N;++i){
bits prod={};
prod[0]=1;
long long soma=0;
for(int j=0;j!=N;++j){
if(i==j)continue;
soma+=array[j];
prod|=prod<<array[j];
}
int meio = soma/2;
permite&=prod>>meio;
}
std::vector<int> pode;
for(int i=1;i!=MAX;++i){
if(permite[i])pode.push_back(i);
}
std::cout<<pode.size()<<"\n";
for(auto&x:pode){
std::cout<<((x*2)-(array[0]&1))<<" ";
}
std::cout<<"\n";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
408 KB |
Output is correct |
4 |
Correct |
3 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
2 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
412 KB |
Output is correct |
9 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
408 KB |
Output is correct |
4 |
Correct |
3 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
2 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
412 KB |
Output is correct |
9 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
408 KB |
Output is correct |
4 |
Correct |
3 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
2 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
412 KB |
Output is correct |
9 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
408 KB |
Output is correct |
4 |
Correct |
3 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
2 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
412 KB |
Output is correct |
9 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
408 KB |
Output is correct |
4 |
Correct |
3 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
2 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
412 KB |
Output is correct |
9 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
332 KB |
Output is correct |
2 |
Correct |
2 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
408 KB |
Output is correct |
4 |
Correct |
3 ms |
408 KB |
Output is correct |
5 |
Correct |
3 ms |
332 KB |
Output is correct |
6 |
Correct |
2 ms |
332 KB |
Output is correct |
7 |
Correct |
2 ms |
412 KB |
Output is correct |
8 |
Correct |
3 ms |
412 KB |
Output is correct |
9 |
Incorrect |
2 ms |
332 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |