Submission #25864

#TimeUsernameProblemLanguageResultExecution timeMemory
25864akynoiCrayfish scrivener (IOI12_scrivener)C++14
100 / 100
746 ms88032 KiB
int depth[1000003]; char ch[1000003]; int pa[1000003][20]; int id[1000003]; int T, top; void Init() { ch[T = 0] = '^'; depth[0] = -1; top = 1; } void TypeLetter(char p) { depth[top] = depth[pa[top][0] = id[T++]] + 1; for (int i = 1; ch[pa[top][i - 1]] != '^'; i++) pa[top][i] = pa[pa[top][i - 1]][i - 1]; ch[id[T] = top++] = p; } void UndoCommands(int m) { id[T + 1] = id[T - m]; T++; } char GetLetter(int m) { int now = id[T], a = depth[id[T]] - m; for (int i = 0, p = 1; a; i++, p <<= 1) if (p & a) now = pa[now][i], a ^= p; return ch[now]; }
#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...