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