#include <bits/stdc++.h>
using namespace std;
pair<char, char> v[1000005];
char s[1000005];
int indx = 0, i = 0;
bool got = false;
void Init() {
}
void TypeLetter(char L) {
v[indx++] = {'T', L};
}
void UndoCommands(int U) {
v[indx++] = {'U', (char)U};
}
char GetLetter(int P) {
if (!got) {
int ptr = indx - 1;
while (ptr > -1) {
while (ptr > -1 && v[ptr].first == 'U') ptr -= v[ptr].second + 1;
if (ptr > -1) s[i++] = v[ptr--].second;
}
got = true;
}
return s[i - 1 - P];
}
// int main() {
// int t;
// cin >> t;
// for (int i = 0; i < t; i++) {
// char c, d; int e;
// cin >> c;
// switch (c) {
// case 'T':
// cin >> d;
// TypeLetter(d);
// break;
// case 'P':
// cin >> e;
// cout << GetLetter(e) << '\n';
// break;
// default:
// cin >> e;
// UndoCommands(e);
// }
// }
// }
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
380 KB |
Output is correct |
2 |
Incorrect |
2 ms |
256 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
89 ms |
6500 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
33 ms |
1656 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |