This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
pair<char, int> v[1000005];
char s[1000005];
int indx = 0, i = 0;
bool got = false;
void Init() {
}
void TypeLetter(char L) {
v[indx++] = {'T', L - 'a'};
}
void UndoCommands(int U) {
v[indx++] = {'U', U + 1};
}
char GetLetter(int P) {
if (!got) {
int ptr = indx - 1;
while (ptr > -1) {
while (v[ptr].first == 'U') ptr -= v[ptr].second;
s[i++] = (char)(v[ptr--].second + 'a');
}
got = true;
}
return s[i - 1 - P];
}
// int main() {
// int t;
// cin >> t;
// Init();
// 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);
// }
// }
// }
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |