This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |