# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
429861 | dolphingarlic | MalnaRISC (COI21_malnarisc) | C++14 | 1 ms | 204 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 <stdio.h>
int main() {
int n;
scanf("%d", &n);
int p2 = 1, blocks = 0;
while (p2 < n) p2 <<= 1, blocks++;
printf("%d\n", blocks * (blocks + 1) / 2);
for (int p = 1; p < p2; p <<= 1) {
for (int k = p; k; k >>= 1) {
for (int j = k % p; j < p2 - k; j += 2 * k) {
for (int i = 0; i < k && i + j + k < n; i++) {
if ((i + j) / (2 * p) == (i + j + k) / (2 * p)) {
printf("CMPSWP R%d R%d ", i + j + 1, i + j + k + 1);
}
}
}
printf("\n");
}
}
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... |