#include <bits/stdc++.h>
#define ii pair < char , char >
#define fi first
#define se second
using namespace std;
const int N=1e6+5;
ii a[N];
char s[N];
bool q=0;
int k=0;
void Init() {}
void TypeLetter(char L) {
a[k].fi='T';
a[k].se=L;
k++;
}
void UndoCommands(int U) {
a[k].fi='F';
a[k].se='0'+U;
k++;
}
int j=0;
char GetLetter(int P) {
if(!q)
{
j=0;
k--;
while(k>=0)
{
if(a[k].fi=='T')
{
s[j]=a[k].se;
j++;
}
else if(a[k].fi=='F')
{
k-=(a[k].se-'0');
}
k--;
}
reverse(s,s+j);
}
q=1;
return s[P];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Incorrect |
2 ms |
488 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
488 KB |
Output is correct |
2 |
Incorrect |
3 ms |
488 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
488 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
269 ms |
3184 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
225 ms |
3184 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |