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;
#define ll long long
char last;
struct CMD{
int prev;
char added;
CMD(int _prev, char _added){
prev = _prev;
added = _added;
}
};
vector<CMD> tree;
string s;
void eval(int id){
if(tree[id].prev != -1){
eval(tree[id].prev);
if(tree[id].added != ' '){
s.push_back(tree[id].added);
}
}
}
void Init() {
tree.push_back(CMD(-1, ' '));
}
void TypeLetter(char L) {
last = L;
tree.push_back(CMD(tree.size()-1, last));
}
void UndoCommands(int U) {
tree.push_back(CMD(tree.size()-1-U, ' '));
}
bool evaled = false;
char GetLetter(int P) {
if(!evaled){
eval(tree.size()-1);
evaled = true;
}
return s[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... |