Submission #104404

#TimeUsernameProblemLanguageResultExecution timeMemory
104404wilwxkCrayfish scrivener (IOI12_scrivener)C++11
34 / 100
1071 ms75832 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN=1e6+3; const int LOGN=22; int cont[MAXN], letra[MAXN]; int dp[MAXN][LOGN+3]; int contv=0; void update(int cur) { int aux=dp[cur][0]; for(int i=1; i<=LOGN; i++) { dp[cur][i]=dp[aux][i-1]; aux=dp[cur][i]; } } void Init() {} void TypeLetter(char cur) { contv++; int pai=contv-1; if(pai==0) pai=contv; letra[contv]=cur; cont[contv]=cont[pai]+1; dp[contv][0]=pai; update(contv); } void UndoCommands(int val) { contv++; int pai=contv-1-val; if(pai==0) pai=contv; cont[contv]=cont[pai]; dp[contv][0]=pai; update(contv); } char GetLetter(int ind) { int cur=contv; int aux=cur; while(aux!=dp[aux][0]&&cont[dp[aux][0]]!=ind) aux=dp[aux][0]; return letra[aux]; }
#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...