#include<bits/stdc++.h>
typedef long long ll;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
using namespace std;
pair<char,int> A[1000002];
int te=1,X;
int p[19][1000002],ii;
void Init()
{
//for(ii=1;ii<=1000002;ii++)
// LO[ii]=ceil(log(ii)/log(2));
}
void TypeLetter(char L)
{
/*if(te==0)
{
A[te]=mp(L,0);
p[0][te]=0;
}
else
{*/
A[te]=mp(L,A[te-1].se+1);
p[0][te]=te-1;
for(ii=1;ii<19;ii++)
p[ii][te]=p[ii-1][p[ii-1][te]];
//}
te++;
}
void UndoCommands(int U)
{
A[te]=A[te-U-1];
p[0][te]=p[0][te-U-1];
for(ii=1;ii<19;ii++)
p[ii][te]=p[ii-1][p[ii-1][te]];
te++;
// cek();
}
char GetLetter(int P)
{
X=te-1;
for(ii=18;ii>=0;ii--)
if(A[p[ii][X]].se>P)
X=p[ii][X];
else
if(A[p[ii][X]].se==P)
return A[p[ii][X]].fi;
return A[X].fi;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
512 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
3 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
398 ms |
59332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
641 ms |
54544 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |