| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 73789 | TuGSGeReL | Crayfish scrivener (IOI12_scrivener) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back
#define ss second
#define ff first
#define ext exit(0)
using namespace std;
char s[1000001];
ll par[1000001][20],l[1000001],i=1,now=0,j;
void Init() {}
inline ll find(int i,int k){
for(j=0;j<20;j++) if((1<<j)&k) i=par[i][j];
return i;
}
inline void TypeLetter(char L) {
s[i]=L;
par[i][0]=now;
l[i]=l[now]+1;
for(j=1;j<20;j++){
if((1<<j)>=l[i])break;
par[i][j]=par[par[i][j-1]][j-1];
}
now=i;
i++;
}
inline void UndoCommands(int U) {
now=i-U-1;
s[i]=s[now];
for(j=0;j<20;j++)par[i][j]=par[now][j];
l[i]=l[now];
i++;
}
inline char GetLetter(int P) {
int x=find(i-1,l[i-1]-P-1);
return s[x];
}
