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;
int node[1000006];
int NEXT_FREE_INDEX=1;
int n=1;
int id[1000006];
char letter[1000006];
int p[1000006];
int len;
void Init() {
len=-1;
id[0]=-1;
}
void TypeLetter(char L) {
node[n]=NEXT_FREE_INDEX;
id[NEXT_FREE_INDEX]=id[ node[n-1] ]+1;
letter[NEXT_FREE_INDEX]=L;
p[NEXT_FREE_INDEX]=node[n-1];
NEXT_FREE_INDEX++;
n++;
}
void UndoCommands(int U) {
node[n]=node[n-U-1];
n++;
}
char GetLetter(int P) {
int k=node[n-1];
while(id[k]>P){
k=p[k];
}
return letter[k];
}
# | 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... |