제출 #390746

#제출 시각아이디문제언어결과실행 시간메모리
390746AmineTrabelsi크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
100 / 100
714 ms90556 KiB
#include <bits/stdc++.h> const int M = 1e6+5; int pos = 1; int parent[M]; int lift[M][20],depth[M]; char lett[M]; void Init(){ } void TypeLetter(char L){ int curr = pos; parent[curr] = pos; lett[curr] = L; if(curr)lift[curr][0] = parent[curr-1]; for(int i=1;lift[curr][i-1];i++){ lift[curr][i] = lift[lift[curr][i-1]][i-1]; } depth[curr] = depth[lift[curr][0]]+1; pos++; } void UndoCommands(int U){ parent[pos] = parent[pos-U-1]; pos++; } char GetLetter(int P){ int curr = parent[pos-1]; for(int i=19;i>=0;i--){ if(depth[lift[curr][i]]>= P+1){ curr = lift[curr][i]; } } return lett[curr]; }
#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...