Submission #62556

#TimeUsernameProblemLanguageResultExecution timeMemory
62556zetapiCrayfish scrivener (IOI12_scrivener)C++14
60 / 100
1081 ms81632 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define mp make_pair #define ll long long #define itr ::iterator typedef pair<int,int> pii; const int MAX=3e6; char last; char X[MAX]; int ind,cur,tot,arr[MAX],height[MAX],Parent[MAX][21]; void Init() { } void TypeLetter(char L) { ++ind; ++tot; X[ind]=L; Parent[ind][0]=arr[tot-1]; height[ind]=height[Parent[ind][0]]+1; for(int A=1;A<21;A++) Parent[ind][A]=Parent[Parent[ind][A-1]][A-1]; arr[tot]=ind; cur=ind; return ; } void UndoCommands(int U) { ++tot; arr[tot]=arr[tot-U-1]; return ; } char GetLetter(int P) { P++; int res=arr[tot]; for(int A=20;A>=0;A--) { if(height[Parent[res][A]]>=P) res=Parent[res][A]; } //cout<<cur<<" "<<res<<" "<<height[res]<<"\n"; return X[res]; } /*signed main() { ios_base::sync_with_stdio(false); TypeLetter('a'); TypeLetter('b'); TypeLetter('d'); UndoCommands(2); UndoCommands(1); cout<<GetLetter(2); return 0; }*/
#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...