# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
68491 | nvmdava | Crayfish scrivener (IOI12_scrivener) | C++17 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
char s[1000001];
int now = 0, i = 1, dir[1000001][21], sz[1000001];
void Init() {}
int find(int x, int y)
{
for(int i = 0; y > 0; y >>= 1, i++)
if(y & 1) x = p[i][x];
return x;
}
void TypeLetter(char L) {
s[i] = L;
dir[i][0] = now;
sz[i] = sz[now] + 1;
dir[i][0] = now;
for(int j = 1; j < 21; j++){
if(sz[i] <= (1 << j)) break;
dir[i][j] = dir[dir[i][j - 1]][j - 1];
}
now = i;
i++;
}
void UndoCommands(int U) {
now = i - U - 1;
s[i] = s[now];
for(int j = 0; j <= 20; j++)dir[i][j] = dir[now][j];
sz[i] = sz[now];
i++;
}
char GetLetter(int P) {
return s[find(i - 1, P + 1)];
}