답안 #344694

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
344694 2021-01-06T08:08:56 Z infertechno2 Bootfall (IZhO17_bootfall) C++14
13 / 100
1000 ms 364 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[3401];
            for(ll x=0;x<3401;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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 47 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 62 ms 364 KB Output is correct
9 Correct 3 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 47 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 62 ms 364 KB Output is correct
9 Correct 3 ms 364 KB Output is correct
10 Correct 12 ms 364 KB Output is correct
11 Correct 120 ms 364 KB Output is correct
12 Correct 9 ms 364 KB Output is correct
13 Correct 7 ms 364 KB Output is correct
14 Correct 130 ms 364 KB Output is correct
15 Correct 73 ms 364 KB Output is correct
16 Correct 107 ms 364 KB Output is correct
17 Correct 22 ms 364 KB Output is correct
18 Correct 67 ms 364 KB Output is correct
19 Correct 57 ms 364 KB Output is correct
20 Correct 13 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 47 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 62 ms 364 KB Output is correct
9 Correct 3 ms 364 KB Output is correct
10 Correct 12 ms 364 KB Output is correct
11 Correct 120 ms 364 KB Output is correct
12 Correct 9 ms 364 KB Output is correct
13 Correct 7 ms 364 KB Output is correct
14 Correct 130 ms 364 KB Output is correct
15 Correct 73 ms 364 KB Output is correct
16 Correct 107 ms 364 KB Output is correct
17 Correct 22 ms 364 KB Output is correct
18 Correct 67 ms 364 KB Output is correct
19 Correct 57 ms 364 KB Output is correct
20 Correct 13 ms 364 KB Output is correct
21 Execution timed out 1085 ms 364 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 47 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 62 ms 364 KB Output is correct
9 Correct 3 ms 364 KB Output is correct
10 Correct 12 ms 364 KB Output is correct
11 Correct 120 ms 364 KB Output is correct
12 Correct 9 ms 364 KB Output is correct
13 Correct 7 ms 364 KB Output is correct
14 Correct 130 ms 364 KB Output is correct
15 Correct 73 ms 364 KB Output is correct
16 Correct 107 ms 364 KB Output is correct
17 Correct 22 ms 364 KB Output is correct
18 Correct 67 ms 364 KB Output is correct
19 Correct 57 ms 364 KB Output is correct
20 Correct 13 ms 364 KB Output is correct
21 Execution timed out 1085 ms 364 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 47 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 62 ms 364 KB Output is correct
9 Correct 3 ms 364 KB Output is correct
10 Correct 12 ms 364 KB Output is correct
11 Correct 120 ms 364 KB Output is correct
12 Correct 9 ms 364 KB Output is correct
13 Correct 7 ms 364 KB Output is correct
14 Correct 130 ms 364 KB Output is correct
15 Correct 73 ms 364 KB Output is correct
16 Correct 107 ms 364 KB Output is correct
17 Correct 22 ms 364 KB Output is correct
18 Correct 67 ms 364 KB Output is correct
19 Correct 57 ms 364 KB Output is correct
20 Correct 13 ms 364 KB Output is correct
21 Execution timed out 1085 ms 364 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 2 ms 364 KB Output is correct
5 Correct 47 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 62 ms 364 KB Output is correct
9 Correct 3 ms 364 KB Output is correct
10 Correct 12 ms 364 KB Output is correct
11 Correct 120 ms 364 KB Output is correct
12 Correct 9 ms 364 KB Output is correct
13 Correct 7 ms 364 KB Output is correct
14 Correct 130 ms 364 KB Output is correct
15 Correct 73 ms 364 KB Output is correct
16 Correct 107 ms 364 KB Output is correct
17 Correct 22 ms 364 KB Output is correct
18 Correct 67 ms 364 KB Output is correct
19 Correct 57 ms 364 KB Output is correct
20 Correct 13 ms 364 KB Output is correct
21 Execution timed out 1085 ms 364 KB Time limit exceeded
22 Halted 0 ms 0 KB -