Submission #566224

# Submission time Handle Problem Language Result Execution time Memory
566224 2022-05-22T07:13:51 Z MrDeboo Bootfall (IZhO17_bootfall) C++17
28 / 100
1000 ms 836 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 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 340 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 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 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 2 ms 324 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 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 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 2 ms 324 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 31 ms 340 KB Output is correct
22 Correct 44 ms 324 KB Output is correct
23 Correct 17 ms 340 KB Output is correct
24 Correct 86 ms 472 KB Output is correct
25 Correct 129 ms 588 KB Output is correct
26 Correct 155 ms 564 KB Output is correct
27 Correct 118 ms 468 KB Output is correct
28 Correct 118 ms 468 KB Output is correct
29 Correct 127 ms 468 KB Output is correct
30 Correct 105 ms 472 KB Output is correct
31 Correct 145 ms 540 KB Output is correct
32 Correct 97 ms 456 KB Output is correct
33 Correct 81 ms 340 KB Output is correct
34 Correct 86 ms 340 KB Output is correct
35 Correct 117 ms 480 KB Output is correct
36 Correct 93 ms 468 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 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 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 2 ms 324 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 31 ms 340 KB Output is correct
22 Correct 44 ms 324 KB Output is correct
23 Correct 17 ms 340 KB Output is correct
24 Correct 86 ms 472 KB Output is correct
25 Correct 129 ms 588 KB Output is correct
26 Correct 155 ms 564 KB Output is correct
27 Correct 118 ms 468 KB Output is correct
28 Correct 118 ms 468 KB Output is correct
29 Correct 127 ms 468 KB Output is correct
30 Correct 105 ms 472 KB Output is correct
31 Correct 145 ms 540 KB Output is correct
32 Correct 97 ms 456 KB Output is correct
33 Correct 81 ms 340 KB Output is correct
34 Correct 86 ms 340 KB Output is correct
35 Correct 117 ms 480 KB Output is correct
36 Correct 93 ms 468 KB Output is correct
37 Execution timed out 1088 ms 836 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 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 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 2 ms 324 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 31 ms 340 KB Output is correct
22 Correct 44 ms 324 KB Output is correct
23 Correct 17 ms 340 KB Output is correct
24 Correct 86 ms 472 KB Output is correct
25 Correct 129 ms 588 KB Output is correct
26 Correct 155 ms 564 KB Output is correct
27 Correct 118 ms 468 KB Output is correct
28 Correct 118 ms 468 KB Output is correct
29 Correct 127 ms 468 KB Output is correct
30 Correct 105 ms 472 KB Output is correct
31 Correct 145 ms 540 KB Output is correct
32 Correct 97 ms 456 KB Output is correct
33 Correct 81 ms 340 KB Output is correct
34 Correct 86 ms 340 KB Output is correct
35 Correct 117 ms 480 KB Output is correct
36 Correct 93 ms 468 KB Output is correct
37 Execution timed out 1088 ms 836 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 1 ms 212 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 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 2 ms 324 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 31 ms 340 KB Output is correct
22 Correct 44 ms 324 KB Output is correct
23 Correct 17 ms 340 KB Output is correct
24 Correct 86 ms 472 KB Output is correct
25 Correct 129 ms 588 KB Output is correct
26 Correct 155 ms 564 KB Output is correct
27 Correct 118 ms 468 KB Output is correct
28 Correct 118 ms 468 KB Output is correct
29 Correct 127 ms 468 KB Output is correct
30 Correct 105 ms 472 KB Output is correct
31 Correct 145 ms 540 KB Output is correct
32 Correct 97 ms 456 KB Output is correct
33 Correct 81 ms 340 KB Output is correct
34 Correct 86 ms 340 KB Output is correct
35 Correct 117 ms 480 KB Output is correct
36 Correct 93 ms 468 KB Output is correct
37 Execution timed out 1088 ms 836 KB Time limit exceeded
38 Halted 0 ms 0 KB -