| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 429795 | dolphingarlic | MalnaRISC (COI21_malnarisc) | C++14 | 1 ms | 332 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int ord[201];
vector<pair<int, int>> swaps[51];
void merge(int l, int sz, bool descending, int level) {
int step = sz / 2;
while (step) {
for (int i = 0; i < sz; i += 2 * step) {
for (int j = i + l; j < i + l + step; j++) {
swaps[level].push_back({ord[j], ord[j + step]});
if (descending) swap(ord[j], ord[j + step]);
}
}
step >>= 1;
level++;
}
}
int main() {
int n, block;
scanf("%d", &n);
iota(ord + 1, ord + 2 * n + 1, 1);
for (block = 1; (1 << block - 1) < n; block++) {
for (int i = 1; i <= n; i += 1 << block + 1) {
int level = block * (block - 1) / 2;
merge(i, 1 << block, false, level);
if (i + (1 << block) <= n)
merge(i + (1 << block), 1 << block, true, level);
}
}
printf("%d\n", block * (block - 1) / 2);
for (int i = 0; i < block * (block - 1) / 2; i++) {
for (pair<int, int> j : swaps[i]) if (j.first <= n && j.second <= n)
printf("CMPSWP R%d R%d ", j.first, j.second);
printf("\n");
}
return 0;
}컴파일 시 표준 에러 (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... | ||||
