Submission #115606

#TimeUsernameProblemLanguageResultExecution timeMemory
115606faustaadpCrayfish scrivener (IOI12_scrivener)C++14
100 / 100
766 ms84924 KiB
#include<bits/stdc++.h> typedef long long ll; #define pb push_back #define mp make_pair #define fi first #define se second using namespace std; pair<char,int> A[1000002]; int te=1,X; int p[19][1000002],ii; void Init() { A[0].se=-1; //for(ii=1;ii<=1000002;ii++) // LO[ii]=ceil(log(ii)/log(2)); } void TypeLetter(char L) { A[te]=mp(L,A[te-1].se+1); p[0][te]=te-1; for(ii=1;ii<19;ii++) p[ii][te]=p[ii-1][p[ii-1][te]]; te++; } void UndoCommands(int U) { A[te]=A[te-U-1]; // p[0][te]=p[0][te-U-1]; // for(ii=1;ii<19;ii++) // p[ii][te]=p[ii-1][p[ii-1][te]]; for(ii=0;ii<19;ii++) p[ii][te]=p[ii][te-U-1]; te++; } char GetLetter(int P) { X=te-1; for(ii=18;ii>=0;ii--) if(A[p[ii][X]].se>P) X=p[ii][X]; else if(A[p[ii][X]].se==P) return A[p[ii][X]].fi; return A[X].fi; }
#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...