Submission #1009428

#TimeUsernameProblemLanguageResultExecution timeMemory
1009428SulACrayfish scrivener (IOI12_scrivener)C++17
100 / 100
675 ms82636 KiB
#include <iostream> #include <vector> #include <string> using namespace std; const int MAXN = 1e6; int t[MAXN+1][20], len[MAXN+1]; int pos = 0; char letter[MAXN+1]; void Init() {} void TypeLetter(char L) { letter[++pos] = L; len[pos] = len[pos-1] + 1; t[pos][0] = pos - 1; for (int b = 1; b < 20; b++) { t[pos][b] = t[t[pos][b-1]][b-1]; } } void UndoCommands(int U) { letter[++pos] = ' '; len[pos] = len[pos - U - 1]; t[pos][0] = pos - U - 1; for (int b = 1; b < 20; b++) { t[pos][b] = t[t[pos][b-1]][b-1]; } } char GetLetter(int P) { int cur = pos; P++; for (int b = 19; b >= 0; b--) { if (len[t[cur][b]] >= P) { cur = t[cur][b]; } } return letter[cur]; } void OutputLogs() {}
#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...