This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
char last;
const int nmax=1000005;
int m[nmax];
void Init() { for(int i=0;i<20;i++) m[(1<<i)]=i;}
char st[nmax];
int lev[nmax],state[nmax],tt[nmax][20];
int curr,states,nr,i,b,lg=19;
void TypeLetter(char L) {
curr=state[states];
st[++nr]=L;state[++states]=nr;
tt[nr][0]=curr;lev[nr]=lev[curr]+1;
for(i=1;i<=lg;i++)
tt[nr][i]=tt[tt[nr][i-1]][i-1];
}
void UndoCommands(int U) {
states++;
state[states]=state[states-U-1];
}
char GetLetter(int P) {
curr=state[states];
P=lev[curr]-P-1;
while(P!=0)
{
b=m[((P^(P-1))&P)];
curr=tt[curr][b];
P&=(P-1);
}
return st[curr];
}
# | 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... |