제출 #1078077

#제출 시각아이디문제언어결과실행 시간메모리
1078077juicy크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
100 / 100
714 ms86720 KiB
#include <bits/stdc++.h> const int N = 1e6 + 5, LG = 20; int n; char c[N]; int pr[LG][N], cnt[N]; void Init() { } void TypeLetter(char L) { c[++n] = L; pr[0][n] = n - 1; cnt[n] = cnt[n - 1] + 1; for (int j = 1; j < LG; ++j) { pr[j][n] = pr[j - 1][pr[j - 1][n]]; } } void UndoCommands(int l) { ++n; pr[0][n] = n - l - 1; cnt[n] = cnt[n - l - 1]; for (int j = 1; j < LG; ++j) { pr[j][n] = pr[j - 1][pr[j - 1][n]]; } } char GetLetter(int p) { int u = n; for (int j = LG - 1; ~j; --j) { if (cnt[pr[j][u]] >= p + 1) { u = pr[j][u]; } } return c[u]; }
#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...