# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
456183 | | grt | Sob (COCI19_sob) | C++17 | | 329 ms | 19088 KiB |
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>
#define ST first
#define ND second
#define PB push_back
using namespace std;
using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;
void solve(vi &a, vi &b, int dep) {
if((int)a.size() <= 1 && (int)b.size() <= 1) {
if((int)a.size() == 1 && (int)b.size() == 1) {
cout << a[0] << " " << b[0] << "\n";
}
return;
}
vi odda, evena, oddb, evenb;
for(int i = 0; i < (int)a.size(); ++i) {
if(a[i] & (1 << dep)) {
odda.PB(a[i]);
} else {
evena.PB(a[i]);
}
}
for(int i = 0; i < (int)b.size(); ++i) {
if(b[i] & (1 << dep)) {
oddb.PB(b[i]);
} else {
evenb.PB(b[i]);
}
}
if(odda.size() != oddb.size()) {
odda.PB(evena.back());
evena.pop_back();
}
solve(evena, evenb, dep + 1);
solve(odda, oddb, dep + 1);
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vi l(n), r(n);
for(int i = 0; i < n; ++i) {
l[i] = i;
r[i] = m + i;
}
solve(l, r, 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... |