Submission #1198288

#TimeUsernameProblemLanguageResultExecution timeMemory
1198288LudisseyCrayfish scrivener (IOI12_scrivener)C++20
0 / 100
223 ms102412 KiB
#include <bits/stdc++.h> #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() using namespace std; const int LOG=21; vector<vector<int>> parent; vector<char> a; vector<int> pos; int c=-1; void Init() { parent.push_back({}); for (int j = 0; j < LOG; j++) parent.back().push_back(0); pos.push_back(0); a.push_back(' '); c=0; } void TypeLetter(char L) { c=sz(a); a.push_back(L); parent.push_back({c}); pos.push_back(c); for (int j = 1; j < LOG; j++) parent.back().push_back(parent[parent[c][j-1]][j-1]); } void UndoCommands(int U) { pos.push_back(pos[sz(pos)-U-1]); c=pos.back(); } char GetLetter(int P) { int u=c; for (int j = LOG-1; j >= 0; j--) { if(P&(1<<j)) u=parent[u][j]; } return a[u]; }
#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...