Submission #63337

#TimeUsernameProblemLanguageResultExecution timeMemory
63337VahanCrayfish scrivener (IOI12_scrivener)C++17
34 / 100
1058 ms105884 KiB
#include<cmath> char last; void Init() {} int t=-1,er[2000000],a[1000005][23]; char v[2000000]; void TypeLetter(char L) { t++; if(t==0) er[t]=1; else er[t]=er[t-1]+1; v[t]=L; for(int i=0;i<log2(er[t]);i++) { if(i==0) a[t][0]=t-1; else a[t][i]=a[a[t][i-1]][i-1]; } } void UndoCommands(int U) { t++; er[t]=er[t-U-1]; v[t]=v[t-U-1]; for(int i=0;i<log2(er[t]);i++) a[t][i]=a[t-U-1][i]; } char GetLetter(int P) { int p=er[t]-P-1; int e=t; while(p!=0) { e=a[e][int(log2(p))]; p-=pow(2,int(log2(p))); } return v[e]; }
#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...