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 <iostream>
#include <vector>
#include <string>
#include <set>
#include <algorithm>
using namespace std;
char last;
string cur;
vector<string> v;
vector<pair<int, int> > logs;
vector<int> who;
void Init() {}
bool oops = true;
void TypeLetter(char L) {
logs.push_back({1, L});
int oo = who.size();
who.push_back(oo);
oops = true;
}
void UndoCommands(int U) {
logs.push_back({2, U});
who.push_back(who.size() - U - 1);
oops = true;
}
string ans = "";
char GetLetter(int P) {
if(oops)
{
oops = false;
int cur = who.size()-1;
while(cur >= 0)
{
if(who[cur] == cur)
{
char lol = logs[cur].second;
ans += lol;
cur --;
}
else
{
cur = who[cur];
}
}
reverse(ans.begin(), ans.end());
}
// cout << "ans = " << ans << "\n";
return ans[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... |