# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
997920 | Qwerty1232 | MalnaRISC (COI21_malnarisc) | C++17 | 1 ms | 348 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>
int32_t main() {
int n0;
std::cin >> n0;
int n = 1 << std::__lg(std::max(1, n0 - 1)) + 1;
if (n0 == 1) {
n = 1;
}
std::vector<std::vector<std::pair<int, int>>> ans;
for (int k = 0; (1 << k) < n; k++) {
ans.insert(ans.end(), k + 1, {});
for (int i = 0; i < n; i += 1 << k + 1) {
for (int k2 = k; k2 >= 0; k2--) {
for (int i2 = 0; i2 < (1 << k + 1); i2 += (1 << k2 + 1)) {
for (int j = 0; j < (1 << k2); j++) {
if (k2 == k) {
ans.rbegin()[k2].push_back({i + i2 + j, i + i2 + ((1 << k2 + 1) - 1 - j)});
} else {
ans.rbegin()[k2].push_back({i + i2 + j, i + i2 + (1 << k2) + j});
}
}
}
}
}
}
std::cout << ans.size() << "\n";
for (auto& vec : ans) {
for (auto [a, b] : vec) {
if (a < n0 && b < n0) {
std::cout << "CMPSWP" << " " << "R" << a + 1 << " " << "R" << b + 1 << " ";
}
}
std::cout << std::endl;
}
return 0;
}
Compilation message (stderr)
# | 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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |