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>
#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][21],l[1000001],i=1,now=0,j;
void Init() {}
ll find(int i,int k){
for(j=0;j<=20;j++) if((1<<j)&k) i=par[i][j];
return i;
}
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++;
}
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++;
}
char GetLetter(int P) {
int x=find(i-1,l[i-1]-P-1);
return s[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... |