# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
759606 | aykhn | Crayfish scrivener (IOI12_scrivener) | C++17 | 0 ms | 0 KiB |
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;
#define mpr make_pair
string s;
vector<pair<int, char>> calls;
int x;
string f(int i)
{
if (i < 0) return "";
if (calls[i].fi == 1) return f(i - 1) + calls[i].se;
return f(i - 1 - calls[i].se);
}
void Init()
{
s = "";
}
void TypeLetter(char L)
{
calls.pb(mpr(1, L));
}
void UndoCommands(int U)
{
calls.pb(mpr(2, U));
}
char GetLetter(int P)
{
x++;
if (x == 1)
{
s = f(calls.size() - 1);
}
return s[P];
}