# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975771 | marinaluca | Crayfish scrivener (IOI12_scrivener) | C++14 | 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.
char c[1000010];
int a[1000010], lev[1000010], st[20][1000010], t;
void Init(){}
void Typeletter (char L){
int i;
c[a[++t] = t] = L;
lev[t] = lev[st[0][t] = a[t - 1]] + 1;
for (i = 1; i < 20; ++ i)
st[i][t] = st[i - 1][st[i - 1][t]];
}
void UndoCommands(int U){a[++t]=a[t-U-1];}
char GetLetter(int P){
int aa = a[t], i;
for (i = 20; i --;)
if (lev[st[i][aa]] > P)
aa = st[i][aa];
return c[aa];
}