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>
struct caracter{int poz;char x;caracter *t[20];}*ans[1000010];
int nr;
void Init()
{
ans[0]=new caracter;
ans[0]->poz=-1;
ans[0]->x=0;
for(int i=0;i<20;++i)
ans[0]->t[i]=ans[0];
return;
}
void TypeLetter(char L)
{
++nr;
ans[nr]=new caracter;
ans[nr]->poz=ans[nr-1]->poz+1;
ans[nr]->x=L;
ans[nr]->t[0]=ans[nr-1];
for(int i=1;i<20;++i)
ans[nr]->t[i]=ans[nr]->t[i-1]->t[i-1];
}
void UndoCommands(int U)
{
++nr;
ans[nr]=ans[nr-U-1];
}
char GetLetter(int P)
{
caracter *ansac=ans[nr];
for(int i=0;i<20;++i)
{
if((1<<i)&(P-ansac->poz))
ansac=ansac->t[i];
}
return ansac->x;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |