#include<bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pub push_back
#define pob pop_back
#define ss second
#define ff first
#define ext exit(0)
using namespace std;
char s[1000001];
ll par[1000001][20],l[1000001],i=1,now=0,j;
void Init() {}
ll find(int i,int k){
for(j=0;j<20;j++) if((1<<j)&k) i=par[i][j];
return i;
}
void TypeLetter(char L) {
s[i]=L;
par[i][0]=now;
l[i]=l[now]+1;
for(j=1;j<20;j++){
if((1<<j)>=l[i])break;
par[i][j]=par[par[i][j-1]][j-1];
}
now=i;
i++;
}
void UndoCommands(int U) {
now=i-U-1;
s[i]=s[now];
for(j=0;j<20;j++)par[i][j]=par[now][j];
l[i]=l[now];
}
char GetLetter(int P) {
int x=find(i-1,l[i-1]-P-1);
return s[x];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
360 KB |
Output is correct |
3 |
Correct |
3 ms |
600 KB |
Output is correct |
4 |
Correct |
3 ms |
600 KB |
Output is correct |
5 |
Correct |
2 ms |
768 KB |
Output is correct |
6 |
Correct |
4 ms |
768 KB |
Output is correct |
7 |
Correct |
3 ms |
768 KB |
Output is correct |
8 |
Correct |
4 ms |
768 KB |
Output is correct |
9 |
Correct |
3 ms |
768 KB |
Output is correct |
10 |
Correct |
3 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
832 KB |
Output is correct |
2 |
Incorrect |
3 ms |
832 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
916 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
249 ms |
74468 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
251 ms |
74468 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |