Submission #566228

# Submission time Handle Problem Language Result Execution time Memory
566228 2022-05-22T07:25:27 Z birthdaycake Bootfall (IZhO17_bootfall) C++17
0 / 100
0 ms 212 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){
            o[s.first]++;
        }
        
    }
    
    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 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 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 Incorrect 0 ms 212 KB Output isn't correct
4 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 Incorrect 0 ms 212 KB Output isn't correct
4 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 Incorrect 0 ms 212 KB Output isn't correct
4 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 Incorrect 0 ms 212 KB Output isn't correct
4 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 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -