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>
using namespace std;
int n, m;
bool podudaranje(int a, int b) {
for (int i = 0; i < 20; i++) {
if ((a & (1 << i)) && !(b & (1 << i))) return false;
}
return true;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n >> m;
int prvi = n - 1;
int drugi = m;
while (prvi >= 0) {
int koliko = 0;
while (!podudaranje(prvi, drugi + koliko)) koliko++;
//cerr << "podudaranje " << prvi << " " << drugi + koliko << " " << drugi << " " << koliko << '\n';
for (int i = koliko; i >= 0; i--, prvi--) {
cout << prvi << " " << drugi + i << '\n';
}
drugi += koliko + 1;
}
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... |