제출 #147314

#제출 시각아이디문제언어결과실행 시간메모리
147314Diuven크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
0 / 100
1077 ms2240 KiB
struct node{ char c='\0'; int up[21]={}, len=0; } S[1000010]; int n; void Init(){ n = 0; } void TypeLetter(char L) { S[++n].c = L; S[n].len = S[n-1].len+1; S[n].up[0] = n-1; for(int i=1; i<=n; i++) S[n].up[i] = S[S[n].up[i-1]].up[i-1]; } void UndoCommands(int U) { node &pv=S[n-U], &nw = S[n+1]; n++; nw.c = pv.c, nw.len = pv.len; for(int i=0; i<=20; i++) nw.up[i] = pv.up[i]; } char GetLetter(int P) { int d = S[n].len-1-P, v = n; for(int i=20; i>=0; i--) if(d>=(1<<i)) d-=(1<<i), v = S[v].up[i]; return S[v].c; }
#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...