Submission #566228

#TimeUsernameProblemLanguageResultExecution timeMemory
566228birthdaycakeBootfall (IZhO17_bootfall)C++17
0 / 100
0 ms212 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...