제출 #239579

#제출 시각아이디문제언어결과실행 시간메모리
239579Coroian_David크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++11
100 / 100
605 ms90616 KiB
#include <bits/stdc++.h> #define MAX_N 1000000 #define MAX_P2 19 using namespace std; int k; int ant[MAX_N + 1][MAX_P2 + 1]; int stk[MAX_N + 1]; int d[MAX_N + 1]; char chr[MAX_N + 1]; void Init() { } void TypeLetter(char L) { k ++; ant[k][0] = stk[k - 1]; stk[k] = k; chr[k] = L; d[k] = d[ant[k][0]] + 1; for(int p2 = 1; p2 <= 19; p2 ++) ant[k][p2] = ant[ant[k][p2 - 1]][p2 - 1]; } void UndoCommands(int U) { k ++; stk[k] = stk[k - 1 - U]; } char GetLetter(int P) { P ++; int len = d[stk[k]] - P; int cr = stk[k]; for(int i = 0; i <= 19; i ++) { if(((1 << i) & len) != 0) cr = ant[cr][i]; } return chr[cr]; }
#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...