# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
308964 | vipghn2003 | Crayfish scrivener (IOI12_scrivener) | C++14 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int N=1e6+5;
int n,curNode,nT,p[N][20],cnt,pos[N],dep[N];
char c[N];
void init()
{
curNode=0;
cnt=0;;
memset(p,-1,sizeof p);
pos[0]=0;
}
void TypeLetter(char L)
{
cnt++;
nT++;
p[nT][0]=curNode;
dep[nT]=dep[curNode]+1;
c[nT]=L;
curNode=nT;
pos[cnt]=curNode;
for(int i=1;i<=18;i++) p[nT][i]=p[p[nT][i-1]][i-1];
}
void UndoCommands(int U)
{