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
#define pb push_back
#define pii pair<int, int>
#define F first
#define S second
const int N = 1000005;
const int mod = 1e9+7;
struct P{
int type;
string ch;
int num;
};
string s = "";
int m = 0, lastty = 0;
P a[N];
string get(int idx){
if(idx < 0) return "";
if(a[idx].type == 1){
return get(idx - 1) + a[idx].ch;
}
else return get(idx - 1 - a[idx].num);
}
void Init() {}
void TypeLetter(char L) {
if(lastty == 1){
m--;
a[m].ch += L;
}
else{
a[m].type = 1;
a[m].num = 0;
a[m].ch = L;
}
m++;
lastty = 1;
}
void UndoCommands(int U) {
a[m].type = 2;
a[m].num = U;
a[m].ch = '1';
m++;
lastty = 2;
}
char GetLetter(int P) {
if(lastty != 3){
s = get(m - 1);
}
lastty = 3;
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... |