# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1002745 | 2024-06-19T19:15:42 Z | pedroslrey | MalnaRISC (COI21_malnarisc) | C++17 | 1 ms | 348 KB |
#include <bits/stdc++.h> using namespace std; vector<vector<pair<int, int>>> solve(int n) { if (n == 1) return {}; int m = (n + 1)/2; vector<vector<pair<int, int>>> ans; for (int i = 0; i < m; ++i) { ans.emplace_back(); for (int j = 0; j < n - m; ++j) ans.back().emplace_back((i + j)%m, j + m); } auto xs = solve(m), ys = solve(n - m); for (int i = 0; i < max(xs.size(), ys.size()); ++i) { ans.emplace_back(); if (i < xs.size()) for (auto p: xs[i]) ans.back().push_back(p); if (i < ys.size()) for (auto [a, b]: ys[i]) ans.back().emplace_back(a + m, b + m); } return ans; } int main() { int n; cin >> n; auto 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 | Partially correct | 0 ms | 348 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 344 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 344 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 348 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 0 ms | 348 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 348 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 348 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 348 KB | Partially correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Partially correct | 1 ms | 348 KB | Partially correct |