#include <bits/stdc++.h>
using namespace std;
int le[1000005],n,k,ch[27][1000005],par[20][1000005],dp[1000005];
char re[1000005];
void Init(void){};
void TypeLetter(char c){
int v=le[n],x=c-'a';
if(ch[x][v]==0){
k++;
ch[x][v]=k;
re[k]=c;
par[0][k]=v;
dp[k]=dp[v]+1;
for(int i=0;i<19;i++)par[i][k]=par[i][par[i][k]];
}
v=ch[x][v];
n++;
le[n]=v;
}
void UndoCommands(int x){
le[n+1]=le[n-x];
n++;
}
char GetLetter(int x){
x++;
int v=le[n];
for(int i=0;i<20;i++)if((dp[v]-x)>>i&1)v=par[i][v];
return re[v];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
504 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
1016 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
288 ms |
107680 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
327 ms |
91384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |