Submission #17130

#TimeUsernameProblemLanguageResultExecution timeMemory
17130muratCrayfish scrivener (IOI12_scrivener)C++98
0 / 100
114 ms15972 KiB
#include<bits/stdc++.h> using namespace std; const int logN = 17; const int N = 2e5 + 5; static int node, lca[N][logN], C, S, W[N]; char col[N]; void Init() { } void TypeLetter(char L) { W[++S] = ++C; col[C] = L; lca[C][0] = node; node = C; for(int i = 1; i <= logN; i++) lca[node][i] = lca[lca[node][i-1]][i-1]; } void UndoCommands(int U) { node = W[S - U]; W[++S] = node; } char GetLetter(int P) { int tt = node; for(int i = logN; i >= 0; i--) if((1 << i) <= P) { P -= (1 << i); tt = lca[tt][i]; } return col[tt]; }
#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...