이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ll long long
const int L=20, A=26, MAX=1e6+1;
struct st{
st *jump[L+1];
vector<st*>g;
int war, gle;
};
int licznik;
st *ope[MAX];
st *root=new st;
void Init(){
for(int i=0; i<L; i++)
root->jump[i]=root;
root->gle=-1;
ope[0]=root;
}
st *dodaj(st *v, char c){
for(auto s: v->g)
if(s->war==c-'a')
return s;
st *nowy=new st;
nowy->war=c-'a';
nowy->gle=v->gle+1;
nowy->jump[0]=v;
for(int i=1; i<=L; i++)
nowy->jump[i]=nowy->jump[i-1]->jump[i-1];
v->g.pb(nowy);
return nowy;
}
void TypeLetter(char c){
licznik++;
st *akt=ope[licznik-1];
akt=dodaj(akt, c);
ope[licznik]=akt;
}
void UndoCommands(int x){
licznik++;
ope[licznik]=ope[licznik-x-1];
}
char GetLetter(int pos){
st *akt=ope[licznik];
//cout<<akt<<"\n";
int x=akt->gle-pos, l=0;
while(x){
if(x%2) akt=akt->jump[l];
x/=2, l++;
}
return char(akt->war+'a');
}
# | 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... |