Submission #434929

#TimeUsernameProblemLanguageResultExecution timeMemory
434929dutchCrayfish scrivener (IOI12_scrivener)C++17
0 / 100
504 ms57540 KiB
#include <bits/stdc++.h> using namespace std; const int LIM = (int)(1e6)+1; char val[LIM]; int u = 0, d[LIM], p[LIM][21], pos[LIM], c = 0; void Init(){} void TypeLetter(char l){ val[++u] = l; p[u][0] = pos[c]; d[u] = d[pos[c]] + 1; ++c; pos[c] = u; for(int i=0; i<20; ++i) p[u][i+1] = p[p[u][i]][i]; } void UndoCommands(int U){ ++c; pos[c] = pos[c-U-1]; } char GetLetter(int P){ int v = pos[c]; for(int i=0; i<21; ++i) if((d[v]-P) & (1<<i)) v = p[v][i]; cout << val[v] << '\n'; return val[v]; }
#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...