Submission #1036269

#TimeUsernameProblemLanguageResultExecution timeMemory
1036269stdfloatCrayfish scrivener (IOI12_scrivener)C++17
100 / 100
479 ms133940 KiB
#include <bits/stdc++.h> using namespace std; const int N = (int)1e6 + 1; int q, cnt, cur; vector<char> ch(N); vector<int> num(N), d(N); vector<vector<int>> sp(N, vector<int>(20)); void Init() {} void TypeLetter(char L) { num[++q] = ++cnt; ch[cnt] = L; d[cnt] = d[cur] + 1; sp[cnt][0] = cur; for (int i = 1; i < 20; i++) sp[cnt][i] = sp[sp[cnt][i - 1]][i - 1]; cur = cnt; } void UndoCommands(int U) { q++; num[q] = cur = num[q - U - 1]; } char GetLetter(int P) { int x = cur; for (int i = 19; i >= 0; i--) { if (P < d[x] - (1 << i)) x = sp[x][i]; } return ch[x]; }
#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...