제출 #815710

#제출 시각아이디문제언어결과실행 시간메모리
815710annabeth9680크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
0 / 100
188 ms51468 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6+25; int curop,sz; char arr[MAXN]; int ops[MAXN],par[MAXN][20],dep[MAXN]; void Init(){ curop = 1; sz = 1; ops[curop] = 1; dep[sz] = 0; for(int i = 1;i<20;++i){ par[1][i] = 1; } } void TypeLetter(char L){ curop++; sz++; ops[curop] = sz; arr[sz] = L; dep[sz] = dep[ops[curop-1]]+1; par[sz][0] = ops[curop-1]; for(int i = 0;i<20;++i){ par[sz][i] = par[par[sz][i-1]][i-1]; } } void UndoCommands(int U){ curop++; ops[curop] = ops[curop-U-1]; } char GetLetter(int P){ P++; int cur = ops[curop]; int d = dep[cur]-P; for(int i = 0;i<20;++i){ if((d >> i)&1){ cur = par[cur][i]; } } return arr[cur]; }
#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...