제출 #986348

#제출 시각아이디문제언어결과실행 시간메모리
986348Pyqe크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
100 / 100
806 ms90476 KiB
#include <bits/stdc++.h> using namespace std; int n=0,a[1000069],pr[1000069][20],dh[1000069]; void bd() { int i; for(i=1;i<20;i++) { pr[n][i]=pr[pr[n][i-1]][i-1]; } } void Init() { } void TypeLetter(char ch) { n++; a[n]=ch-'a'; pr[n][0]=n-1; dh[n]=dh[n-1]+1; bd(); } void UndoCommands(int x) { n++; pr[n][0]=n-1-x; dh[n]=dh[n-1-x]; bd(); } char GetLetter(int x) { int i,p=n; x++; for(i=19;i+1;i--) { if(dh[pr[p][i]]>=x) { p=pr[p][i]; } } return (char)(a[p]+'a'); }
#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...