Submission #17131

#TimeUsernameProblemLanguageResultExecution timeMemory
17131muratCrayfish scrivener (IOI12_scrivener)C++98
34 / 100
113 ms16752 KiB
#include<bits/stdc++.h> using namespace std; const int logN = 17; const int N = 2e5 + 5; static int depth[N], 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]; depth[node] = depth[lca[node][0]] + 1; } void UndoCommands(int U) { node = W[S - U]; W[++S] = node; } char GetLetter(int P) { P = depth[node] - P - 1; 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...