# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975767 | 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 ans[1000010];
int a[1000010], rez[1000010], mat[20][1000010], t;
void Init(){}
void Typeletter (char L){
int i;
ans[a[++t] = t] = L;
rez[t] = rez[mat[0][t] = v[t - 1]] + 1;
for (i = 1; i < 20; ++ i)
mat[i][t] = mat[i - 1][mat[i - 1][t]];
}
void UndoCommands(int U){v[++t] = v[t - U - 1];}
char GetLetter(int P){
int a = v[t], i;
for ( i = 20; i --;)
if (rez[mat[i][a]] > P)
a = mat[i][a];
return ans[a];
}