제출 #103002

#제출 시각아이디문제언어결과실행 시간메모리
103002wxh010910크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
100 / 100
834 ms90668 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1234567; const int LOG = 20; int t, from[N], depth[N], anc[N][LOG]; char type[N]; void Init() { t = 1; } void TypeLetter(char L) { type[t] = L; depth[t] = depth[from[t - 1]] + 1; anc[t][0] = from[t - 1]; for (int i = 1; depth[t] >> i; ++i) { anc[t][i] = anc[anc[t][i - 1]][i - 1]; } from[t] = t; ++t; } void UndoCommands(int U) { from[t] = from[t - 1 - U]; ++t; } char GetLetter(int P) { int jump = depth[from[t - 1]] - 1 - P; int x = from[t - 1]; for (int i = 0; jump >> i; ++i) { if (jump >> i & 1) { x = anc[x][i]; } } return type[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...