이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |