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 maxq=1e6;
char pre[maxq+1];
int a[maxq+1][21],curr,len[maxq+1];
string s;
void Init() {
}
void TypeLetter(char l) {
curr++;
pre[curr]=l;
len[curr]=len[curr-1]+1;
a[curr][0]=curr-1;
for(int i=1;i<=20;i++){
a[curr][i]=a[a[curr][i-1]][i-1];
}
}
void UndoCommands(int u) {
curr++;
len[curr]=len[curr-u-1];
a[curr][0]=curr-u-1;
for(int i=1;i<=20;i++){
a[curr][i]=a[a[curr][i-1]][i-1];
}
}
char GetLetter(int p) {
int c=curr;
for(int i=20;i>-1;i--){
if(len[a[c][i]]>p)c=a[c][i];
}
return pre[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... |