Submission #73791

#TimeUsernameProblemLanguageResultExecution timeMemory
73791TuGSGeReLCrayfish scrivener (IOI12_scrivener)C++14
100 / 100
980 ms173996 KiB
#include<bits/stdc++.h> #define ll long long #define mp make_pair #define pub push_back #define pob pop_back #define ss second #define ff first #define ext exit(0) using namespace std; char s[1000001]; ll par[1000001][21],l[1000001],i=1,now=0,j; void Init() {} ll find(int i,int k){ for(j=0;j<=20;j++) if((1<<j)&k) i=par[i][j]; return i; } void TypeLetter(char L) { s[i]=L; par[i][0]=now; l[i]=l[now]+1; for(j=1;j<=20;j++){ if((1<<j)>=l[i])break; par[i][j]=par[par[i][j-1]][j-1]; } now=i; i++; } void UndoCommands(int U) { now=i-U-1; s[i]=s[now]; for(j=0;j<=20;j++)par[i][j]=par[now][j]; l[i]=l[now]; i++; } char GetLetter(int P) { int x=find(i-1,l[i-1]-P-1); return s[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...