#include <ext/rope>
__gnu_cxx::crope ver[1000010]; //set up all versions with rope data struct
int curr_ver = 0; //and track version number
void Init(){}
void TypeLetter(char L) {
//newest version is just previous version + new char
curr_ver++;
ver[curr_ver] = ver[curr_ver-1] + L;
}
void UndoCommands(int U) {
//using the fact undos are just jumps to U steps back, newest version = U steps back from last version
curr_ver++;
ver[curr_ver] = ver[curr_ver-1-U];
}
char GetLetter (int P) {
//Pth letter is simply current version's Pth letter
return ver[curr_ver][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... |