#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m;
cin >> n >> m;
list<int> l;
for (int i = m; i < m + n; ++i) {
l.push_back(i);
}
auto it = l.begin();
for (int i = n - 1; i >= 0; --i) {
auto tit = it;
while ((i & *it) != i && it != l.begin()) {
--it;
}
if ((i & *it) == i) {
cout << i << ' ' << *it << '\n';
it = l.erase(it);
if (it == l.end()) --it;
continue;
}
it = tit;
while ((i & *it) != i && next(it) != l.end()) {
++it;
}
cout << i << ' ' << *it << '\n';
it = l.erase(it);
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
736 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
3 ms |
456 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Runtime error |
1 ms |
460 KB |
Execution killed with signal 6 |
3 |
Halted |
0 ms |
0 KB |
- |