Submission #3189

#TimeUsernameProblemLanguageResultExecution timeMemory
3189cki86201Crayfish scrivener (IOI12_scrivener)C++98
100 / 100
700 ms87992 KiB
const int MX = 1000010; char p[MX]; int up[MX][20],a[MX],cnt,dep[MX]; void Init(){dep[0]=-1;} void TypeLetter(char L){ ++cnt; p[cnt]=L; a[cnt]=cnt; up[cnt][0]=a[cnt-1]; dep[cnt]=dep[a[cnt-1]]+1; int i,tmp=up[cnt][0]; for(i=1;i<20;i++){ if(up[tmp][i-1]){ up[cnt][i]=up[tmp][i-1]; tmp=up[cnt][i]; } else break; } } void UndoCommands(int U){ a[cnt+1]=a[cnt-U]; cnt++; } char GetLetter(int P){ int i,tmp=a[cnt]; for(i=19;i>=0;i--){ if(dep[up[tmp][i]]<P)continue; tmp=up[tmp][i]; } return p[tmp]; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...