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 LIM = (int)(1e6)+1;
char val[LIM];
int u = 0, d[LIM], p[LIM][20], pos[LIM], c = 0;
void Init(){}
void TypeLetter(char l){
val[++u] = l;
p[u][0] = pos[c];
d[u] = d[pos[c]] + 1;
++c;
pos[c] = u;
for(int i=0; i<19; ++i) p[u][i+1] = p[p[u][i]][i];
}
void UndoCommands(int U){
++c;
pos[c] = pos[c-U-1];
}
char GetLetter(int P){
int v = pos[c]; ++P;
for(int i=0; i<20; ++i) if((d[v]-P) & (1<<i)) v = p[v][i];
return val[v];
}
# | 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... |