Submission #310890

#TimeUsernameProblemLanguageResultExecution timeMemory
310890juggernautCrayfish scrivener (IOI12_scrivener)C++14
100 / 100
744 ms62968 KiB
#include<bits/stdc++.h> using namespace std; int up[1000005][20],depth[1000005],pos[1000005],timer,tmp,v,i; char res[1000005]; void Init(){} void TypeLetter(char ch){ res[++v]=ch; up[v][0]=tmp; depth[v]=depth[tmp]+1; tmp=v; pos[++timer]=tmp; for(i=1;i<20;i++)up[tmp][i]=up[up[tmp][i-1]][i-1]; } void UndoCommands(int num){ tmp=pos[timer-num]; timer++; pos[timer]=tmp; } char GetLetter(int p){ p++; int to=tmp; for(i=19;i>=0;i--)if(depth[up[to][i]]>=p)to=up[to][i]; return res[to]; }
#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...