Submission #8087

#TimeUsernameProblemLanguageResultExecution timeMemory
8087dohyun0324Crayfish scrivener (IOI12_scrivener)C++98
100 / 100
540 ms111432 KiB
char last; int p[1000010][25],a[1000010],pos[1000010],n,len[1000010]; char str[1000010]; void Init() {} void TypeLetter(char L) { int i; n++; p[n][0]=pos[n-1]; for(i=1;i<=20;i++) { p[n][i]=p[p[n][i-1]][i-1]; } pos[n]=n; len[n]=len[p[n][0]]+1; str[n]=L; } void UndoCommands(int U) { int i; n++; pos[n]=pos[n-U-1]; len[n]=len[pos[n]]; } char GetLetter(int P) { int i; int m,dir=pos[n]; m=len[n]-P-1; for(i=0;i<=20;i++) { if(m&(1<<i)) { m-=(1<<i); dir=p[dir][i]; } } return str[dir]; }
#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...