#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 i=0;
void Init() {}
void TypeLetter(char L) {
a[i]={'T',L};
i++;
}
void UndoCommands(int U) {
a[i]={'U','0'+U};
i++;
}
int j=0;
char GetLetter(int P) {
int cnt=0;
if(!q)
{
j=0;
while(i>0)
{
i--;
if(a[i].fi=='T')
{
s[j]=a[i].se;
j++;
}
else if(a[i].fi=='U')
{
i-=(a[i].se-'0');
}
else
break;
cnt++;
if(cnt>1e7)
assert(0);
}
reverse(s,s+j);
}
q=1;
return s[P];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
248 KB |
Output is correct |
2 |
Incorrect |
3 ms |
356 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
560 KB |
Output is correct |
2 |
Incorrect |
3 ms |
560 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
4 ms |
560 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
159 ms |
2200 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
225 ms |
2384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |