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;
#define N 1000005
struct A{
char c;
int len,p[20];
}s[N];
int sz;
void Init(){}
void TypeLetter(char c){
s[sz+1]={c,s[sz].len+1,sz};
sz++;
for(int i=1;i<20;i++)
s[sz].p[i]=s[s[sz].p[i-1]].p[i-1];
}
void UndoCommands(int u){
s[sz+1]=s[sz-u];
sz++;
}
char GetLetter(int p){
int now=sz;
p=s[now].len-p-1;
for(int i=0;i<20;i++)
if(p&(1<<i))
now=s[now].p[i];
return s[now].c;
}
# | 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... |