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 N = (int)1e6 + 1;
int q, cnt, cur;
vector<char> ch(N);
vector<int> num(N), pr(N), d(N);
void Init() {}
void TypeLetter(char L) {
num[++q] = ++cnt;
ch[cnt] = L;
pr[cnt] = cur;
d[cnt] = d[cur] + 1;
cur = cnt;
}
void UndoCommands(int U) {
q++;
num[q] = cur = num[q - U - 1];
}
char GetLetter(int P) {
P = d[cur] - P - 1;
int x = cur;
while (P--) x = pr[x];
return ch[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... |