| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 944503 | rainboy | 입력숫자 (KOI13_mystery) | C11 | 1 ms | 748 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
#define N	30
int n;
int ds[N], rr[N]; char marked[N];
int find(int i) {
	return ds[i] < 0 ? i : (ds[i] = find(ds[i]));
}
void join(int i, int j) {
	i = find(i);
	j = find(j);
	if (i == j)
		return;
	if (ds[i] > ds[j])
		ds[i] = j;
	else {
		if (ds[i] == ds[j])
			ds[i]--;
		ds[j] = i, rr[i] = rr[j];
	}
}
int next(int i) {
	return !marked[i] ? i : (rr[find(i)] + 1) % n;
}
void mark(int i) {
	marked[i] = 1;
	if (marked[(i - 1 + n) % n])
		join((i - 1 + n) % n, i);
	if (marked[(i + 1) % n])
		join(i, (i + 1) % n);
}
int main() {
	static int aa[N];
	int h, i;
	scanf("%d", &n);
	memset(ds, -1, n * sizeof *ds);
	for (i = 0; i < n; i++)
		rr[i] = i;
	i = 0;
	for (h = 0; h < n; h++) {
		i = next(i);
		scanf("%d", &aa[i]);
		mark(i);
		i = (i + aa[i]) % n;
	}
	printf("%d\n", n);
	for (i = 0; i < n; i++)
		printf("%d ", aa[i]);
	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... | ||||
