Submission #835290

#TimeUsernameProblemLanguageResultExecution timeMemory
835290KerimCrayfish scrivener (IOI12_scrivener)C++17
100 / 100
329 ms70064 KiB
#define MAXN 2000003 #include "bits/stdc++.h" using namespace std; const int LOGN=21; int nd, now, P[MAXN][LOGN], lvl[MAXN]; vector<int> where; char arr[MAXN]; void Init() {} char get(int x){ int tmp = now; for(int i = LOGN-1; i>=0; i--) if (x >= (1<<i)) tmp = P[tmp][i], x -= (1<<i); return arr[tmp]; } void TypeLetter(char L) { int to = ++nd; arr[to] = L; P[to][0] = now; lvl[to] = lvl[now]+1; now = nd; for(int i=1;i<LOGN;i++) if(P[now][i-1]) P[now][i]=P[P[now][i-1]][i-1]; where.push_back(now); } void UndoCommands(int U) { now = where[int(where.size())-U-1]; where.push_back(now); } char GetLetter(int P) { return get(lvl[now]-P-1); }
#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...