#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[19][1000001],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;
}
# |
Verdict |
Execution time |
Memory |
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 |
19 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 |
# |
Verdict |
Execution time |
Memory |
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 |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
640 KB |
Output is correct |
2 |
Correct |
3 ms |
768 KB |
Output is correct |
3 |
Correct |
3 ms |
768 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 |
3 ms |
768 KB |
Output is correct |
8 |
Correct |
3 ms |
896 KB |
Output is correct |
9 |
Correct |
3 ms |
896 KB |
Output is correct |
10 |
Correct |
3 ms |
896 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
374 ms |
59284 KB |
Output is correct |
2 |
Correct |
437 ms |
72432 KB |
Output is correct |
3 |
Correct |
348 ms |
71800 KB |
Output is correct |
4 |
Correct |
404 ms |
75256 KB |
Output is correct |
5 |
Correct |
462 ms |
66456 KB |
Output is correct |
6 |
Correct |
296 ms |
78460 KB |
Output is correct |
7 |
Execution timed out |
1071 ms |
65656 KB |
Time limit exceeded |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
610 ms |
54528 KB |
Output is correct |
2 |
Correct |
745 ms |
47224 KB |
Output is correct |
3 |
Correct |
390 ms |
60024 KB |
Output is correct |
4 |
Correct |
416 ms |
52088 KB |
Output is correct |
5 |
Correct |
365 ms |
69832 KB |
Output is correct |
6 |
Correct |
412 ms |
72016 KB |
Output is correct |
7 |
Correct |
417 ms |
71928 KB |
Output is correct |
8 |
Execution timed out |
1090 ms |
58140 KB |
Time limit exceeded |
9 |
Halted |
0 ms |
0 KB |
- |