Submission #114950

#TimeUsernameProblemLanguageResultExecution timeMemory
114950zoooma13Crayfish scrivener (IOI12_scrivener)C++14
12 / 100
816 ms262144 KiB
#include <bits/stdc++.h> using namespace std; //#include "grader.cpp" #define MAX_N 5003 struct command{ bool add; string x; }; string curr_text = ""; int curr_comm; vector <command> last[5003]; void Init(){ curr_text = ""; curr_comm = 0; } void TypeLetter(char L){ curr_text += L; last[++curr_comm].push_back({1 ,string(1 ,L)}); //cout << curr_comm << " " << curr_text << endl; } void UndoCommands(int U){ ++curr_comm; for(int i=curr_comm-1; i>=curr_comm-U; i--){ for(command&c : last[i]){ if(!c.add) curr_text += c.x; else curr_text = curr_text.substr(0 ,curr_text.size()-c.x.size()); last[curr_comm].push_back({!c.add ,c.x}); } } reverse(last[curr_comm].begin() ,last[curr_comm].end()); //cout << curr_comm << " " << curr_text << endl; } char GetLetter(int P){ return curr_text[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...