Submission #1016352

#TimeUsernameProblemLanguageResultExecution timeMemory
1016352FaggiCrayfish scrivener (IOI12_scrivener)C++11
Compilation error
0 ms0 KiB
#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]; }

Compilation message (stderr)

scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:29:23: error: a function-definition is not allowed here before '{' token
   29 | char GetLetter(int P) {
      |                       ^
scrivener.cpp:32:1: error: expected '}' at end of input
   32 | }
      | ^
scrivener.cpp:23:26: note: to match this '{'
   23 | void UndoCommands(int U) {
      |                          ^