Submission #986345

#TimeUsernameProblemLanguageResultExecution timeMemory
986345PyqeCrayfish scrivener (IOI12_scrivener)C++17
60 / 100
1064 ms174928 KiB
#include <bits/stdc++.h> using namespace std; long long n=0,a[1000069],pr[1000069][20],dh[1000069]; void bd() { long long 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) { long long 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...