Submission #1066757

#TimeUsernameProblemLanguageResultExecution timeMemory
1066757LuvidiCrayfish scrivener (IOI12_scrivener)C++17
100 / 100
690 ms90528 KiB
#include <bits/stdc++.h> using namespace std; const int maxq=1e6; char pre[maxq+1]; int a[maxq+1][21],curr,len[maxq+1]; string s; void Init() { } void TypeLetter(char l) { curr++; pre[curr]=l; len[curr]=len[curr-1]+1; a[curr][0]=curr-1; for(int i=1;i<=20;i++){ a[curr][i]=a[a[curr][i-1]][i-1]; } } void UndoCommands(int u) { curr++; len[curr]=len[curr-u-1]; a[curr][0]=curr-u-1; for(int i=1;i<=20;i++){ a[curr][i]=a[a[curr][i-1]][i-1]; } } char GetLetter(int p) { int c=curr; for(int i=20;i>-1;i--){ if(len[a[c][i]]>p)c=a[c][i]; } return pre[c]; }
#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...