| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1128111 | _Temirhan | Bootfall (IZhO17_bootfall) | C++20 | 11 ms | 2116 KiB | 
#include <bits/stdc++.h>
using namespace std;
  
#define int long long
#define pb push_back
#define sz(x) x.size()
#define F first
#define S second
#define nl '\n'
void Tima() 
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
}  
const int N = 501 * 501;
const int inf = 1e12;
const int mod = 998244353;
signed main() 
{
    // Tima();
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >>n;
    int a[n + 1], sum = 0;
    for( int i = 1; i <= n; ++i )
    {
        cin >>a[i];
        sum += a[i];
    }
    bool dp[n + 1][N];
    for( int i = 1; i <= n; ++i )
        for( int w = 0; w < N; ++w )
            dp[i][w] = 0;
    for( int k = 1; k <= n; ++k )
    {
        dp[k][0] = 1;
        for( int i = 1; i <= n; ++i )
        {
            if( i == k )
                continue;
            for( int w = N - 1; w >= a[i]; --w )
                if( dp[k][w - a[i]] == 1 )
                    dp[k][w] = 1;
        }
    }
    vector< int >ans;
    for( int x = 1; x <= N; ++x )
    {
        int cnt = 0;
        for( int k = 1; k <= n; ++k )
        {
            int s = sum - a[k];
            if( (s + x) & 1 )
                continue;
            if( dp[k][(s + x) / 2 - x] && dp[k][(s + x) / 2] )
                ++cnt;
        }
        if( cnt == n )
            ans.pb( x );
    }
    cout <<sz(ans) <<nl;
    for( int i: ans )
        cout <<i <<' ';
}
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... | ||||
