Submission #310881

#TimeUsernameProblemLanguageResultExecution timeMemory
310881tengiz05Crayfish scrivener (IOI12_scrivener)C++17
100 / 100
745 ms67320 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1e6+5; int up[N][20], depth[N], pos[N]; char a[N]; int cur=0, timer=0, node=0; void Init() { return; } void TypeLetter(char L) { timer++; node++; a[node] = L; up[node][0] = cur; depth[node] = depth[cur]+1; cur = node; pos[timer] = cur; for(int i=1;i<20;i++){ up[cur][i] = up[up[cur][i-1]][i-1]; }return; } void UndoCommands(int U) { cur = pos[timer-U]; timer++; pos[timer] = cur; } char GetLetter(int P) { P++; int u=cur; for(int i=19;i>=0;i--){ if(depth[up[u][i]] >= P)u = up[u][i]; }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...