Submission #442642

#TimeUsernameProblemLanguageResultExecution timeMemory
442642jesus_coconutSob (COCI19_sob)C++17
10 / 110
66 ms12012 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...