Submission #566225

# Submission time Handle Problem Language Result Execution time Memory
566225 2022-05-22T07:14:19 Z MrDeboo Bootfall (IZhO17_bootfall) C++17
28 / 100
1000 ms 832 KB
#include <bits/stdc++.h>
// #define int long long
#define endl '\n'
using namespace std;
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    int arr[n];
    for(auto &i:arr)cin>>i;
    vector<bool>v(500*n+1);
    v[0]=1;
    int sm=0;
    for(int i=0;i<n;i++){
        sm+=arr[i];
        for(int w=500*n;w>=0;w--){
            if(v[w])v[w+arr[i]]=1;
        }
    }
    if(sm%2!=0||!v[sm/2]){cout<<0;return 0;}
    sm++;
    vector<int>ans(sm);
    for(int i=0;i<n;i++){
        vector<bool>vec(sm);
        vec[0]=1;
        int smm=0;
        for(int w=0;w<n;w++){
            if(w==i)continue;
            smm+=arr[w];
            for(int j=sm;j>=0;j--){
                if(vec[j])vec[j+arr[w]]=1;
            }
        }
        set<int>st;
        for(int w=0;w<=sm;w++){
            if(vec[w])st.insert(abs(smm-w-w));
        }
        for(auto &w:st)ans[w]++;
    }
    int cnt=0;
    for(auto &i:ans){
        if(i==n)cnt++;
    }
    cout<<cnt<<endl;
    for(int i=1;i<=sm;i++){
        if(ans[i]==n)cout<<i<<' ';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 36 ms 324 KB Output is correct
22 Correct 50 ms 416 KB Output is correct
23 Correct 18 ms 384 KB Output is correct
24 Correct 109 ms 444 KB Output is correct
25 Correct 149 ms 468 KB Output is correct
26 Correct 180 ms 520 KB Output is correct
27 Correct 132 ms 436 KB Output is correct
28 Correct 140 ms 424 KB Output is correct
29 Correct 150 ms 468 KB Output is correct
30 Correct 119 ms 448 KB Output is correct
31 Correct 165 ms 516 KB Output is correct
32 Correct 114 ms 428 KB Output is correct
33 Correct 118 ms 340 KB Output is correct
34 Correct 110 ms 344 KB Output is correct
35 Correct 144 ms 432 KB Output is correct
36 Correct 108 ms 440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 36 ms 324 KB Output is correct
22 Correct 50 ms 416 KB Output is correct
23 Correct 18 ms 384 KB Output is correct
24 Correct 109 ms 444 KB Output is correct
25 Correct 149 ms 468 KB Output is correct
26 Correct 180 ms 520 KB Output is correct
27 Correct 132 ms 436 KB Output is correct
28 Correct 140 ms 424 KB Output is correct
29 Correct 150 ms 468 KB Output is correct
30 Correct 119 ms 448 KB Output is correct
31 Correct 165 ms 516 KB Output is correct
32 Correct 114 ms 428 KB Output is correct
33 Correct 118 ms 340 KB Output is correct
34 Correct 110 ms 344 KB Output is correct
35 Correct 144 ms 432 KB Output is correct
36 Correct 108 ms 440 KB Output is correct
37 Execution timed out 1090 ms 832 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 36 ms 324 KB Output is correct
22 Correct 50 ms 416 KB Output is correct
23 Correct 18 ms 384 KB Output is correct
24 Correct 109 ms 444 KB Output is correct
25 Correct 149 ms 468 KB Output is correct
26 Correct 180 ms 520 KB Output is correct
27 Correct 132 ms 436 KB Output is correct
28 Correct 140 ms 424 KB Output is correct
29 Correct 150 ms 468 KB Output is correct
30 Correct 119 ms 448 KB Output is correct
31 Correct 165 ms 516 KB Output is correct
32 Correct 114 ms 428 KB Output is correct
33 Correct 118 ms 340 KB Output is correct
34 Correct 110 ms 344 KB Output is correct
35 Correct 144 ms 432 KB Output is correct
36 Correct 108 ms 440 KB Output is correct
37 Execution timed out 1090 ms 832 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 2 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 2 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 36 ms 324 KB Output is correct
22 Correct 50 ms 416 KB Output is correct
23 Correct 18 ms 384 KB Output is correct
24 Correct 109 ms 444 KB Output is correct
25 Correct 149 ms 468 KB Output is correct
26 Correct 180 ms 520 KB Output is correct
27 Correct 132 ms 436 KB Output is correct
28 Correct 140 ms 424 KB Output is correct
29 Correct 150 ms 468 KB Output is correct
30 Correct 119 ms 448 KB Output is correct
31 Correct 165 ms 516 KB Output is correct
32 Correct 114 ms 428 KB Output is correct
33 Correct 118 ms 340 KB Output is correct
34 Correct 110 ms 344 KB Output is correct
35 Correct 144 ms 432 KB Output is correct
36 Correct 108 ms 440 KB Output is correct
37 Execution timed out 1090 ms 832 KB Time limit exceeded
38 Halted 0 ms 0 KB -