Submission #1016355

#TimeUsernameProblemLanguageResultExecution timeMemory
1016355FaggiCrayfish scrivener (IOI12_scrivener)C++11
34 / 100
146 ms262144 KiB
#include <bits/stdc++.h> using namespace std; string s; vector<int>borr; set<pair<int,string>>se; bool band=1; void Init() { s=""; } void TypeLetter(char L) { s+=L; borr.push_back(0); } void UndoCommands(int U) { auto it=se.lower_bound({(int(borr.size())-U),""}); se.insert({(int(borr.size())),s}); if(it!=se.end()) { pair<int,string>pa=*it; int falt= U-(int(borr.size())-pa.first); s=pa.second; s.resize(int(s.size())-falt); } else s.resize(int(s.size())-(U)); borr.push_back(U); } void arm() { string res=""; for(int i=int(s.size())-1; i>=0; i--) { if(s[i]!='0') { res+=s[i]; } else { i-=borr[i]; } } s=""; for(int i=int(res.size())-1; i>=0; i--) { s+=res[i]; } } char GetLetter(int P) { if(band) arm(); band=0; return s[P]; }
#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...