# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1003609 | 2024-06-20T13:54:32 Z | pedroslrey | MalnaRISC (COI21_malnarisc) | C++17 | 1 ms | 348 KB |
#include <bits/stdc++.h> using namespace std; using ops = vector<vector<pair<int, int>>>; ops faz_morro(int n) { if (n == 1) return {}; ops ans(1); int m = (n + 1)/2; for (int i = 0; i < n/2; ++i) ans.back().emplace_back(i, i + m); auto xss = faz_morro(n/2); auto yss = faz_morro((n + 1)/2); for (int i = 0; i < yss.size(); ++i) { ans.emplace_back(); if (i < xss.size()) for (auto [a, b]: xss[i]) ans.back().emplace_back(a, b); int m = n/2; for (auto [a, b]: yss[i]) ans.back().emplace_back(a + m, b + m); } return ans; } ops solve(int n) { if (n == 1) return {}; auto xss = solve(n/2); auto yss = solve((n + 1)/2); ops ans; for (int i = 0; i < yss.size(); ++i) { ans.emplace_back(); if (i < xss.size()) for (auto [a, b]: xss[i]) ans.back().emplace_back(a, b); int m = n/2; for (auto [a, b]: yss[i]) ans.back().emplace_back(b + m, a + m); } auto mss = faz_morro(n); for (auto &ms: mss) { ans.emplace_back(); for (auto m: ms) ans.back().push_back(m); } return ans; } int main() { int n; cin >> n; ops ans = solve(n); cout << ans.size() << "\n"; for (auto &xs: ans) { for (auto [a, b]: xs) cout << "CMPSWP R" << a + 1 << " R" << b + 1 << " "; cout << "\n"; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 344 KB | not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | not sorted |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 344 KB | not sorted |
2 | Halted | 0 ms | 0 KB | - |