제출 #974424

#제출 시각아이디문제언어결과실행 시간메모리
974424lucri크레이피쉬 글쓰는 기계 (IOI12_scrivener)C++17
100 / 100
431 ms133540 KiB
#include<bits/stdc++.h> struct caracter{int poz;char x;caracter *t[20];}*ans[1000010]; int nr; void Init() { ans[0]=new caracter; ans[0]->poz=-1; ans[0]->x=0; for(int i=0;i<20;++i) ans[0]->t[i]=ans[0]; return; } void TypeLetter(char L) { ++nr; ans[nr]=new caracter; ans[nr]->poz=ans[nr-1]->poz+1; ans[nr]->x=L; ans[nr]->t[0]=ans[nr-1]; for(int i=1;i<20;++i) ans[nr]->t[i]=ans[nr]->t[i-1]->t[i-1]; } void UndoCommands(int U) { ++nr; ans[nr]=ans[nr-U-1]; } char GetLetter(int P) { caracter *ansac=ans[nr]; for(int i=0;i<20;++i) { if((1<<i)&(P-ansac->poz)) ansac=ansac->t[i]; } return ansac->x; }
#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...