Submission #574274

#TimeUsernameProblemLanguageResultExecution timeMemory
574274mosiashvililukaCrayfish scrivener (IOI12_scrivener)C++14
100 / 100
987 ms97812 KiB
#include<bits/stdc++.h> using namespace std; int a,b,c,d,e,i,j,ii,jj,zx,xc,pi,zm[1000009],p[1000009],ZM,P,msh[1000009][22]; char ch[1000009]; void Init(){ } void TypeLetter(char L) { P++;pi++; p[pi]=P;zm[pi]=zm[pi-1]+1; ch[P]=L; //msh[pi]=msh[pi-1]; msh[pi][0]=msh[pi-1][0]; for(j=1; j<=20; j++){ msh[pi][j]=msh[msh[pi][j-1]][j-1]; } } void UndoCommands(int U) { pi++; zm[pi]=zm[pi-U-1]; p[pi]=P; msh[pi][0]=pi-U-1; for(j=1; j<=20; j++){ msh[pi][j]=msh[msh[pi][j-1]][j-1]; } } char GetLetter(int P) { P++; c=pi; for(j=20; j>=0; j--){ if(zm[msh[c][j]]>=P){ c=msh[c][j]; } } zx=p[c]-(zm[c]-P); return ch[zx]; }
#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...