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 MAXN = 1e6 + 10;
const int MAXK = 21;
vector<char> v; vector<int> tam;
int dp[MAXK][MAXN];
int id = 0;
void Init()
{
v.push_back('-');
tam.push_back(-1);
}
void TypeLetter(char L)
{
v.push_back(L);
tam.push_back(tam.back()+1);
++id;
dp[0][id] = id-1;
for (int k = 1; k < MAXK; k++) dp[k][id] = dp[k-1][ dp[k-1][id] ];
}
void UndoCommands(int U)
{
tam.push_back(tam[id-U]);
v.push_back('X');
dp[0][id+1] = id-U;
++id;
for (int k = 1; k < MAXK; k++) dp[k][id] = dp[k-1][ dp[k-1][id] ];
}
char GetLetter(int P)
{
int X = id;
for (int k = MAXK-1; k >= 0; k--)
{
if (tam[dp[k][X]] >= P) X = dp[k][X];
}
return v[X];
}
# | 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... |