#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];
int cnt;
int i;
void Init() {}
void TypeLetter(char L) {
a[i].fi='T';
a[i].se=L;
i++;
}
void UndoCommands(int U) {
a[i].fi='U';
a[i].se='0'+U;
i++;
}
char GetLetter(int P) {
if(cnt==0)
{
for(int k=0;k<i;k++)
if(a[k].fi!='U'&&a[k].fi!='T')
assert(0);
int j=0;
for(int k=i-1;k>=0;k--)
{
if(a[k].fi=='T')
{
s[j]=a[k].se;
j++;
}
else if(a[k].fi=='U')
{
k-=(a[k].se-'0');
}
// else if(a[k].fi==0)
// assert(0);
}
reverse(s,s+j);
}
// cnt=1;
return s[P];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
464 KB |
Output is correct |
3 |
Correct |
2 ms |
592 KB |
Output is correct |
4 |
Correct |
3 ms |
592 KB |
Output is correct |
5 |
Correct |
3 ms |
592 KB |
Output is correct |
6 |
Correct |
3 ms |
604 KB |
Output is correct |
7 |
Correct |
3 ms |
604 KB |
Output is correct |
8 |
Correct |
2 ms |
604 KB |
Output is correct |
9 |
Correct |
3 ms |
776 KB |
Output is correct |
10 |
Correct |
3 ms |
776 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
776 KB |
Output is correct |
2 |
Correct |
2 ms |
776 KB |
Output is correct |
3 |
Correct |
3 ms |
776 KB |
Output is correct |
4 |
Correct |
4 ms |
776 KB |
Output is correct |
5 |
Correct |
3 ms |
776 KB |
Output is correct |
6 |
Correct |
3 ms |
776 KB |
Output is correct |
7 |
Correct |
2 ms |
776 KB |
Output is correct |
8 |
Correct |
2 ms |
776 KB |
Output is correct |
9 |
Correct |
3 ms |
776 KB |
Output is correct |
10 |
Correct |
2 ms |
776 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
251 ms |
2704 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
209 ms |
5668 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
170 ms |
5668 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |