This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
//#include "grader.cpp"
#define MAX_N 5003
struct command{
bool add;
char 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 ,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.pop_back();
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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |