이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> stac;
void Init() {
vector<int> initial(23, 0);
stac.push_back(initial);
}
void TypeLetter(char L) {
int x = stac.size();
vector<int> newstac;
newstac.push_back(stac[x-1][0]+1);
newstac.push_back(L-'a');
newstac.push_back(x-1);
for (int i=3; i<=22; i++)
newstac.push_back(stac[x-1][i-1]);
stac.push_back(newstac);
}
void UndoCommands(int U) {
int curr = stac.size() - 1;
stac.push_back(stac[curr-U]);
}
char GetLetter(int P) {
int height = stac.size();
int text_length = stac[height-1][0];
int akyat = text_length-1-P;
int curr = height-1;
for (int i=20; i>=0; i--)
{
if (akyat>=(1<<i))
{
akyat -= (1<<i);
curr = stac[curr][i+2];
}
}
char ans = ('a'+stac[curr][1]);
return ans;
}
# | 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... |