Submission #684534

# Submission time Handle Problem Language Result Execution time Memory
684534 2023-01-21T14:06:46 Z infertechno2 Bootfall (IZhO17_bootfall) C++14
13 / 100
1000 ms 476 KB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
 
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    ll n,str_sum=0;
    cin>>n;
    vector<ll> answers;
    ll all_players[501];
    for(ll i=0;i<n;i++){
        cin>>all_players[i];
        str_sum+=all_players[i];
    }
    if(str_sum%2!=0){cout<<0<<endl; return 0;}
    for(ll i=1;i<=str_sum;i++){
        all_players[n]=i;
        bool is_friendly=true;
        for(ll j=0;j<=n;j++){
            ll new_sum=str_sum+all_players[n]-all_players[j];
            if(new_sum%2!=0){is_friendly=false; break;}
            bool knapsack[25001];
            for(ll x=0;x<25001;x++)knapsack[x]=false;
            knapsack[0]=true;
            for(ll x=0;x<j;x++){
                vector<ll> hold_off;
                for(ll y=0;y<=new_sum/2-all_players[x];y++){
                    if(knapsack[y]){
                        hold_off.push_back(y+all_players[x]);
                    }
                }
                for(ll y=0;y<(ll)hold_off.size();y++){
                    knapsack[hold_off[y]]=true;
                }
            }
            for(ll x=j+1;x<=n;x++){
                vector<ll> hold_off;
                for(ll y=0;y<=new_sum/2-all_players[x];y++){
                    if(knapsack[y]){
                        hold_off.push_back(y+all_players[x]);
                    }
                }
                for(ll y=0;y<(ll)hold_off.size();y++){
                    knapsack[hold_off[y]]=true;
                }
            }
            if(!knapsack[new_sum/2]){
                is_friendly=false;
                break;
            }
        }
        if(is_friendly){
            answers.push_back(i);
        }
    }
    cout<<answers.size()<<endl;
    for(ll i=0;i<(ll)answers.size();i++){
        cout<<answers[i]<<" ";
    }
    cout<<endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 33 ms 352 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 44 ms 424 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 33 ms 352 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 44 ms 424 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 10 ms 344 KB Output is correct
11 Correct 79 ms 340 KB Output is correct
12 Correct 6 ms 352 KB Output is correct
13 Correct 5 ms 340 KB Output is correct
14 Correct 83 ms 340 KB Output is correct
15 Correct 50 ms 340 KB Output is correct
16 Correct 70 ms 340 KB Output is correct
17 Correct 14 ms 340 KB Output is correct
18 Correct 50 ms 476 KB Output is correct
19 Correct 38 ms 340 KB Output is correct
20 Correct 10 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 33 ms 352 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 44 ms 424 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 10 ms 344 KB Output is correct
11 Correct 79 ms 340 KB Output is correct
12 Correct 6 ms 352 KB Output is correct
13 Correct 5 ms 340 KB Output is correct
14 Correct 83 ms 340 KB Output is correct
15 Correct 50 ms 340 KB Output is correct
16 Correct 70 ms 340 KB Output is correct
17 Correct 14 ms 340 KB Output is correct
18 Correct 50 ms 476 KB Output is correct
19 Correct 38 ms 340 KB Output is correct
20 Correct 10 ms 340 KB Output is correct
21 Execution timed out 1095 ms 340 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 33 ms 352 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 44 ms 424 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 10 ms 344 KB Output is correct
11 Correct 79 ms 340 KB Output is correct
12 Correct 6 ms 352 KB Output is correct
13 Correct 5 ms 340 KB Output is correct
14 Correct 83 ms 340 KB Output is correct
15 Correct 50 ms 340 KB Output is correct
16 Correct 70 ms 340 KB Output is correct
17 Correct 14 ms 340 KB Output is correct
18 Correct 50 ms 476 KB Output is correct
19 Correct 38 ms 340 KB Output is correct
20 Correct 10 ms 340 KB Output is correct
21 Execution timed out 1095 ms 340 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 33 ms 352 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 44 ms 424 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 10 ms 344 KB Output is correct
11 Correct 79 ms 340 KB Output is correct
12 Correct 6 ms 352 KB Output is correct
13 Correct 5 ms 340 KB Output is correct
14 Correct 83 ms 340 KB Output is correct
15 Correct 50 ms 340 KB Output is correct
16 Correct 70 ms 340 KB Output is correct
17 Correct 14 ms 340 KB Output is correct
18 Correct 50 ms 476 KB Output is correct
19 Correct 38 ms 340 KB Output is correct
20 Correct 10 ms 340 KB Output is correct
21 Execution timed out 1095 ms 340 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 33 ms 352 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 44 ms 424 KB Output is correct
9 Correct 2 ms 340 KB Output is correct
10 Correct 10 ms 344 KB Output is correct
11 Correct 79 ms 340 KB Output is correct
12 Correct 6 ms 352 KB Output is correct
13 Correct 5 ms 340 KB Output is correct
14 Correct 83 ms 340 KB Output is correct
15 Correct 50 ms 340 KB Output is correct
16 Correct 70 ms 340 KB Output is correct
17 Correct 14 ms 340 KB Output is correct
18 Correct 50 ms 476 KB Output is correct
19 Correct 38 ms 340 KB Output is correct
20 Correct 10 ms 340 KB Output is correct
21 Execution timed out 1095 ms 340 KB Time limit exceeded
22 Halted 0 ms 0 KB -