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;
struct cmd { bool undo; int x; char c; };
string s;
vector<cmd> v;
bool rebuild = false;
void Init() {}
void TypeLetter(char L) {
rebuild = true;
v.push_back({false, 0, L});
}
void UndoCommands(int U) {
rebuild = true;
v.push_back({true, U, '.'});
}
char GetLetter(int P) {
if (rebuild)
{
rebuild = false;
s.clear();
for (int i = v.size() - 1; i >= 0; i--)
{
if (v[i].undo) i -= v[i].x;
else s.push_back(v[i].c);
}
reverse(s.begin(), s.end());
//cout << s << endl;
}
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... |