제출 #447866

#제출 시각아이디문제언어결과실행 시간메모리
447866Pietra크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++14
0 / 100
6 ms1100 KiB
#include<bits/stdc++.h> using namespace std ; const int maxn = 1e6 + 5 ; const int maxl = 23 ; int n, tempo, t[maxn], h[maxn], tab[maxl][maxn] ; char s[maxn] ; void TypeLetter(char L) { n++ ; tempo++ ; t[tempo] = n ; s[tempo] = L ; tab[n][0] = t[tempo-1] ; h[n] = h[tempo-1] + 1 ; for(int i = 1 ; i < maxl ; i++) tab[i][n] = tab[i-1][tab[i-1][n]] ; } void UndoCommands(int U) { tempo++ ; t[tempo] = t[tempo - U - 1] ; } char GetLetter(int P) { int at = t[tempo] ; int alt = h[t[tempo]] - P - 1 ; for(int i = maxl - 1 ; i >= 0 ; i--){ if(alt >= (1<<i)) alt -= (1<<i), at = tab[i][at] ; } return s[at] ; } void Init(){ }
#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...