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 <string>
struct String{
int len;
char last;
int prev;
String():last('\0'),prev(-1){
}
}str[1000001];
int curr=0;
void Init() {}
void TypeLetter(char L) {
str[curr+1].len=str[curr].len+1;
str[curr+1].last=L;
str[curr+1].prev=curr;
curr++;
}
void UndoCommands(int U) {
str[curr+1]=str[curr-U];
curr++;
}
char GetLetter(int P) {
int move=str[curr].len-1-P;
int x=curr;
while(move--){
x=str[x].prev;
}
return str[x].last;
}
# | 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... |