#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[1000001];
int te,X;
int p[22][1000001];
int LO[1000005],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);
else
A[te]=mp(L,A[te-1].se+1);
if(te==0)
p[0][te]=0;
else
p[0][te]=te-1;
for(ii=1;ii<20;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<20;ii++)
p[ii][te]=p[ii-1][p[ii-1][te]];
te++;
// cek();
}
char GetLetter(int P)
{
X=te-1;
for(ii=19;ii>=0;ii--)
if(A[p[ii][X]].se>=P)
{
if(A[p[ii][X]].se==P)
{
X=p[ii][X];
break;
}
X=p[ii][X];
}
return A[X].fi;
// return hai[P];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
512 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
2 ms |
512 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
512 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
2 ms |
512 KB |
Output is correct |
8 |
Correct |
2 ms |
512 KB |
Output is correct |
9 |
Correct |
2 ms |
512 KB |
Output is correct |
10 |
Correct |
2 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
512 KB |
Output is correct |
2 |
Correct |
2 ms |
512 KB |
Output is correct |
3 |
Correct |
2 ms |
512 KB |
Output is correct |
4 |
Correct |
2 ms |
512 KB |
Output is correct |
5 |
Correct |
2 ms |
512 KB |
Output is correct |
6 |
Correct |
2 ms |
512 KB |
Output is correct |
7 |
Correct |
2 ms |
512 KB |
Output is correct |
8 |
Correct |
2 ms |
512 KB |
Output is correct |
9 |
Correct |
2 ms |
512 KB |
Output is correct |
10 |
Correct |
2 ms |
512 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
768 KB |
Output is correct |
3 |
Correct |
3 ms |
896 KB |
Output is correct |
4 |
Correct |
3 ms |
896 KB |
Output is correct |
5 |
Correct |
3 ms |
768 KB |
Output is correct |
6 |
Correct |
3 ms |
896 KB |
Output is correct |
7 |
Correct |
4 ms |
896 KB |
Output is correct |
8 |
Correct |
4 ms |
896 KB |
Output is correct |
9 |
Correct |
4 ms |
896 KB |
Output is correct |
10 |
Correct |
3 ms |
1024 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
380 ms |
62152 KB |
Output is correct |
2 |
Correct |
463 ms |
75768 KB |
Output is correct |
3 |
Correct |
377 ms |
75236 KB |
Output is correct |
4 |
Correct |
424 ms |
78712 KB |
Output is correct |
5 |
Correct |
458 ms |
69624 KB |
Output is correct |
6 |
Correct |
322 ms |
82168 KB |
Output is correct |
7 |
Correct |
970 ms |
70556 KB |
Output is correct |
8 |
Correct |
860 ms |
84500 KB |
Output is correct |
9 |
Correct |
503 ms |
80792 KB |
Output is correct |
10 |
Correct |
258 ms |
89848 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
679 ms |
57036 KB |
Output is correct |
2 |
Correct |
841 ms |
49404 KB |
Output is correct |
3 |
Correct |
396 ms |
62712 KB |
Output is correct |
4 |
Correct |
425 ms |
54392 KB |
Output is correct |
5 |
Correct |
365 ms |
73064 KB |
Output is correct |
6 |
Correct |
383 ms |
75512 KB |
Output is correct |
7 |
Correct |
400 ms |
75384 KB |
Output is correct |
8 |
Execution timed out |
1078 ms |
59764 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |