Submission #119829

# Submission time Handle Problem Language Result Execution time Memory
119829 2019-06-22T13:13:14 Z dolphingarlic Crayfish scrivener (IOI12_scrivener) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

pair<char, char> v[1000001];
char s[1000001];
int indx = 0, i = 0;
bool got = false;

void Init() {
}

void TypeLetter(char L) {
  v[indx++] = {'T', L};
}

void UndoCommands(int U) {
  v[indx++] = {'U', (char)U};
}

char GetLetter(int P) {
  if (!got) {
    int ptr = indx - 1;
    while (ptr != -1) {
      while (ptr != -1 && v[ptr].first == 'U') ptr -= v[ptr].second + 1;
      s[i++] = v[ptr--].second;
    }
    got = true;
  }
  return t[i - 1 - P];
}

// int main() {
//   int t;
//   cin >> t;
//   for (int i = 0; i < t; i++) {
//     char c, d; int e;
//     cin >> c;
//     switch (c) {
//       case 'T':
//         cin >> d;
//         TypeLetter(d);
//         break;
//       case 'P':
        
//         cin >> e;
//         cout << GetLetter(e) << '\n';
//         break;
//       default:
//         cin >> e;
//         UndoCommands(e);
//     }
//   }
// }

Compilation message

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:30:10: error: 't' was not declared in this scope
   return t[i - 1 - P];
          ^