# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
483284 | rainboy | Knjige (COCI20_knjige) | C11 | 3 ms | 536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#define N 100
#define M 100000
int main() {
static int aa[N];
static char tt[M], xx[M], yy[M];
int n, m, h, i, j, j_, tmp;
scanf("%d", &n);
for (i = n - 1; i >= 0; i--)
scanf("%d", &aa[i]);
m = 0;
for (i = 0; i < n; i++) {
j_ = i;
for (j = i + 1; j < n; j++)
if (aa[j_] < aa[j])
j_ = j;
if (j_ == i)
continue;
for (j = n - 1; j >= i; j--)
if (j != j_)
tt[m] = 'U', xx[m] = 'L', yy[m] = 'L', m++, tt[m] = 'S', xx[m] = 'L', yy[m] = 'D', m++;
else
tt[m] = 'U', xx[m] = 'R', yy[m] = 'L', m++;
tt[m] = 'S', xx[m] = 'R', yy[m] = 'L', m++;
for (j = i; j <= n - 1; j++)
if (j != j_)
tt[m] = 'U', xx[m] = 'L', yy[m] = 'D', m++, tt[m] = 'S', xx[m] = 'L', yy[m] = 'L', m++;
tmp = aa[j_];
for (j = j_; j > i; j--)
aa[j] = aa[j - 1];
aa[i] = tmp;
}
printf("%d\n", m);
for (h = 0; h < m; h++)
printf("%s %c %c\n", tt[h] == 'U' ? "UZMI" : "STAVI", xx[h], yy[h]);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |