제출 #229610

#제출 시각아이디문제언어결과실행 시간메모리
229610maruii크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
100 / 100
479 ms67320 KiB
int cnt, cnt2, par[20][1000001], A[1000001], dep[1000001]; char S[1000001]; void Init() { } void TypeLetter(char L) { ++cnt2; S[cnt2] = L; dep[cnt2] = dep[A[cnt]] + 1; par[0][cnt2] = A[cnt]; for (int i = 1; i < 20; ++i) par[i][cnt2] = par[i - 1][par[i - 1][cnt2]]; ++cnt; A[cnt] = cnt2; } void UndoCommands(int U) { int x = cnt - U; ++cnt; A[cnt] = A[x]; } char GetLetter(int P) { int x = A[cnt]; for (int i = 0; i < 20; ++i) if (((dep[x] - P - 1) >> i) & 1) { x = par[i][x]; } return S[x]; }
#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...