제출 #518685

#제출 시각아이디문제언어결과실행 시간메모리
518685sliviu크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
100 / 100
456 ms89528 KiB
#include <bits/stdc++.h> int nr; struct state { char letter; int length, p[20]; } s[1000001]; void Init() {} void TypeLetter(char L) { s[nr + 1] = {L,s[nr].length + 1, nr}; ++nr; for (int i = 1; i < 20; ++i) s[nr].p[i] = s[s[nr].p[i - 1]].p[i - 1]; } void UndoCommands(int U) { s[nr + 1] = s[nr - U]; ++nr; } char GetLetter(int P) { int cur = nr; P = s[cur].length - 1 - P; for (int i = 0; i < 20; ++i) if (P & (1 << i)) cur = s[cur].p[i]; return s[cur].letter; }
#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...