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;
const int N = 1111111;
int p[N], v[N];
int cnt = 0;
void Init() {
p[0] = -1;
v[0] = '-';
}
void TypeLetter(char L) {
int id = ++cnt;
p[id] = cnt - 1;
v[id] = L;
}
void UndoCommands(int U) {
int par = cnt;
int t = U;
while (t--) {
par--;
}
int id = ++cnt;
p[id] = par;
v[id] = '-';
// for (int i = 0; i <= 20; i++) {
// cout << p[i] << " ";
// }
// cout << endl;
// for (int i = 0; i <= 20; i++) {
// cout << (char)v[i] << " ";
// }
// cout << endl;
}
string s;
void solve() {
if (!s.empty()) return;
int pr = cnt;
while (pr != -1) {
if (v[pr] != '-') s.push_back(v[pr]);
pr = p[pr];
}
reverse(s.begin(), s.end());
}
char GetLetter(int P) {
solve();
return s[P];
}
# | 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... |