# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1016352 | Faggi | Crayfish scrivener (IOI12_scrivener) | C++11 | 0 ms | 0 KiB |
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 <iostream>
#include <vector>
#include <stack>
#include <string>
using namespace std;
vector<string> textHistory;
stack<int> undoStack;
void Init() {
textHistory.clear();
undoStack = stack<int>();
textHistory.push_back("");
}
void TypeLetter(char L) {
string currentText = textHistory.back();
currentText.push_back(L);
textHistory.push_back(currentText);
}
void UndoCommands(int U) {
for (int i = 0; i < U; ++i) {
undoStack.push(textHistory.size() - 1);
textHistory.pop_back();
}
char GetLetter(int P) {
string currentText = textHistory.back();
return currentText[P];
}