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;
void Init() {}
int p[1111111][22], sz[1111111], id = 0;
char c[1111111];
void TypeLetter(char l) {
id += 1;
c[id] = l;
p[id][0] = id - 1;
sz[id] = sz[id - 1] + 1;
for (int i = 1; i < 20; i++) {
p[id][i] = p[p[id][i - 1]][i - 1];
}
}
void UndoCommands(int u) {
id += 1;
c[id] = c[id - u - 1];
sz[id] = sz[id - u - 1];
for (int i = 0; i < 20; i++) {
p[id][i] = p[id - u - 1][i];
}
}
char GetLetter(int x) {
int d = sz[id] - (x + 1), cur = id;
for (int i = 0; i < 20; i++) {
if (d >> i & 1) {
cur = p[cur][i];
}
}
return c[cur];
}
# | 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... |