# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
785647 | MODDI | Crayfish scrivener (IOI12_scrivener) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int up[1000005][24], dep[1000005], pos[1000005];
char bukva[1000005];
int cur, i, n;
void Init() {
n = 0;
pos[0] = 0;
dep[0] = -1;
for(int i = 0; i < 24; i++) up[0][i] = 0;
}
void TypeLetter(char L) {
++n;
pos[n] = n;
dep[n] = dep[pos[n-1]]+1;
up[n][0] = pos[n-1];
for(int i = 1; i < 24; i++) up[n][i] = up[up[n][i-1]][i-1];
}
void UndoCommands(int U) {
++n;
pos[n] = pos[n-1-U];
}
char GetLetter(int P) {
cur = pos[n];
for(int i = 23; i >=0; --i){
if(dep[up[cur][i]] >= P) cur = up[cur][i];
}
return cr[cur];
}