제출 #850204

#제출 시각아이디문제언어결과실행 시간메모리
850204abcvuitunggio크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
100 / 100
334 ms143184 KiB
char last,c[1000001]; int p[1000001][20],child[1000001][26],d[1000001],q[1000001],id,cur,idx; void Init(){} void TypeLetter(char L){ if (!child[cur][L-'a']){ child[cur][L-'a']=++idx; c[idx]=L; p[idx][0]=cur; d[idx]=d[cur]+1; for (int i=1;i<20;i++) p[idx][i]=p[p[idx][i-1]][i-1]; } cur=child[cur][L-'a']; id++; q[id]=cur; } void UndoCommands(int U){ cur=q[id-U]; id++; q[id]=cur; } char GetLetter(int P){ int k=d[cur]-P-1,u=cur; for (int i=19;i>=0;i--) if ((1<<i)<=k){ u=p[u][i]; k-=(1<<i); } return c[u]; }
#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...