Submission #878935

# Submission time Handle Problem Language Result Execution time Memory
878935 2023-11-25T15:47:12 Z heeheeheehaaw Bootfall (IZhO17_bootfall) C++17
0 / 100
1 ms 600 KB
#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 <= sum; j++)
            if(dp[j] == 1)
                sepoate[sum - 2 * j]++;

        sum += v[i];
    }

    int lim = sum / 2, rez = 0;
    vector<int> aux;
    for(int i = 0; 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

bootfall.cpp: In function 'int main()':
bootfall.cpp:26:13: warning: unused variable 'lim' [-Wunused-variable]
   26 |         int lim = sum / 2;
      |             ^~~
bootfall.cpp:34:9: warning: unused variable 'lim' [-Wunused-variable]
   34 |     int lim = sum / 2, rez = 0;
      |         ^~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -