답안 #18852

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
18852 2016-02-16T02:25:01 Z suhgyuho_william 크레이피쉬 글쓰는 기계 (IOI12_scrivener) C++
0 / 100
242 ms 91896 KB
#include <stdio.h>

int rear,cnt;
int par[1000010][22];
int next[1000010];
char a[1000010];

void Init(){
	rear = cnt = 0;
}

void TypeLetter(char L) {
	int i;

	rear++; cnt++;
	next[cnt] = rear;
	a[rear] = L;
	par[rear][0] = next[cnt];
	for(i=1; i<=19; i++){
		par[rear][i] = par[par[rear][i-1]][i-1];
	}
}

void UndoCommands(int U) {
	cnt++;
	next[cnt] = next[cnt-U-1];
}

char GetLetter(int P) {
	int i,x;
	int ans;

	ans = next[cnt];
	x = next[cnt]-(P+1);
	//printf("%d %d\n",ans,x);
	for(i=19; i>=0; i--){
		if(x >= (1 << i)){
			ans = par[ans][i];
			x -= (1 << i);
		}
	}
	return a[ans];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 91896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 91896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 91896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 200 ms 91896 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 242 ms 91896 KB Output isn't correct
2 Halted 0 ms 0 KB -