Submission #524322

#TimeUsernameProblemLanguageResultExecution timeMemory
524322iskhakkutbilimTable Tennis (info1cup20_tabletennis)C++14
0 / 100
3093 ms4180 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; typedef tree <int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set; int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, k; cin >> n >> k; vector<int> a(n+k); for(int i = 0;i < n+k; i++){ cin >> a[i]; } for(int j = 0; j + n < n + k; j++){ int m = j + n; for(int mask = 0; mask < (1 << (m)); mask++){ vector<int> sub; int c1 = 0, c2 = 0; for(int i = j;i < m; i++){ sub.push_back(a[i]); if(mask & (1 << i)){ c1+= a[i]; }else c2+= a[i]; } if(c1 == c2){ for(auto x : sub) cout << x << " "; return 0; } } } reverse(a.begin(), a.end()); for(int j = 0; j + n < n + k; j++){ int m = j + n; for(int mask = 0; mask < (1 << (m)); mask++){ vector<int> sub; int c1 = 0, c2 = 0; for(int i = j;i < m; i++){ sub.push_back(a[i]); if(mask & (1 << i)){ c1+= a[i]; }else c2+= a[i]; } if(c1 == c2){ for(auto x : sub) cout << x << " "; return 0; } } } if(n == 1) cout << a[0]; random_shuffle(a.begin(), a.end()); for(int j = 0; j + n < n + k; j++){ int m = j + n; for(int mask = 0; mask < (1 << (m)); mask++){ vector<int> sub; int c1 = 0, c2 = 0; for(int i = j;i < m; i++){ sub.push_back(a[i]); if(mask & (1 << i)){ c1+= a[i]; }else c2+= a[i]; } if(c1 == c2){ for(auto x : sub) cout << x << " "; return 0; } } } 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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...