#include <bits/stdc++.h>
using namespace std;
char s[1000001];
int now = 0, i = 0, dir[1000001][21], sz[1000001];
void Init() {}
int find(int i, int x){
if(sz[i] < x){
return i;
}
if(sz[i] == x){
return i;
}
int j = 1;
while(sz[i] / (1 << j) * ((1 << j) - 1) > x){
j++;
}
j--;
return find(dir[i][j], x);
}
void TypeLetter(char L) {
s[i] = L;
dir[i][0] = now;
sz[i] = sz[now] + 1;
dir[i][0] = now;
for(int j = 1; j < 21; j++){
dir[i][j] = find(now, sz[i] / (1 << j) * ((1 << j) - 1));
}
now = i;
i++;
}
void UndoCommands(int U) {
now = i - U - 1;
s[i] = s[now];
for(int j = 0; j <= 20; j++)dir[i][j] = dir[now][j];
sz[i] = sz[now];
i++;
}
char GetLetter(int P) {
return s[find(i, P + 1)];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1075 ms |
376 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1076 ms |
488 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1081 ms |
488 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1085 ms |
616 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1073 ms |
692 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |