Submission #566236

# Submission time Handle Problem Language Result Execution time Memory
566236 2022-05-22T07:33:07 Z birthdaycake Bootfall (IZhO17_bootfall) C++17
6 / 100
1000 ms 340 KB
#include<bits/stdc++.h>
#define endl '\n'
#define int long long
#define mod 1000000007
#define boost ios_base::sync_with_stdio(false), cin.tie(NULL);
using namespace std;
 
 
 

int a[200001];
signed main(){
    boost;
    
    
    
    int n; cin >> n;
    
    map<int,int>o;
    
    
    for(int i = 0; i < n; i++) cin >> a[i];
    
    for(int i = 0; i < n; i++){
        vector<int>x;
        map<int,int>freq;
        for(int j = 0; j < n; j++){
            if(i != j) x.push_back(a[j]);
        }
        for(int j = 1; j < (1 << (n - 1)); j++){
            int c = 0, d = 0;
            for(int k = 0; k < n - 1; k++){
                if(j & (1 << k)) c += x[k];
                else d += x[k];
            }
            freq[abs(d - c)]++;
        }
        
        
        for(auto s:freq){
            if(s.first == 0) continue;
            o[s.first]++;
        }
        
    }
    bool b = 0;
    for(int i = 1; i < (1 << n) - 1; i++){
        int c = 0, d =  0;
        for(int j = 0; j < n; j++){
            if(i & (1 << j)) c += a[j];
            else d += a[j];
            
        }
        if(c == d) b = 1;
    }
    if(!b){
        cout << 0;
        return 0;
    }
    vector<int>ans;
    for(auto s:o){
        if(s.second == n){
            ans.push_back(s.first);
        }
    }
    cout << ans.size() << endl;
    for(auto s:ans){
        cout << s << ' ';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Execution timed out 1088 ms 212 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Execution timed out 1088 ms 212 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Execution timed out 1088 ms 212 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Execution timed out 1088 ms 212 KB Time limit exceeded
11 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 3 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Execution timed out 1088 ms 212 KB Time limit exceeded
11 Halted 0 ms 0 KB -