Submission #442642

# Submission time Handle Problem Language Result Execution time Memory
442642 2021-07-08T12:07:53 Z jesus_coconut Sob (COCI19_sob) C++17
10 / 110
66 ms 12012 KB
#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);
		if (it == l.end()) --it;
	}
}

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);

	solve();

	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 308 KB Output is correct
4 Correct 66 ms 12012 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 1 ms 312 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 308 KB Output is correct
4 Correct 66 ms 12012 KB Output is correct
5 Incorrect 1 ms 332 KB Output isn't correct
6 Halted 0 ms 0 KB -