# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
878934 | heeheeheehaaw | Bootfall (IZhO17_bootfall) | C++17 | 1 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
bitset<125005> dp;
int v[505], sepoate[250005];
int main()
{
int n, sum = 0;
cin>>n;
for(int i = 1; i <= n; i++)
cin>>v[i], sum += v[i];
for(int i = 1; i <= n; i++)
{
dp.reset();
sum -= v[i];
dp[0] = 1;
for(int j = 1; j <= n; j++)
{
if(j == i) continue;
dp = ((dp << v[j]) | dp);
}
int lim = sum / 2;
for(int j = 0; j <= lim; j++)
if(dp[j] == 1)
sepoate[sum - 2 * j]++;
sum += v[i];
}
int lim = sum / 2, rez = 0;
vector<int> aux;
for(int i = 1; i <= sum; i++)
if(sepoate[i] == n)
rez++, aux.push_back(i);
cout<<rez<<'\n';
for(auto it : aux) cout<<it<<" ";
return 0;
}
Compilation message (stderr)
# | 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... |