Submission #119910

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

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

void Init() {
}

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

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

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

// int main() {
//   ll t;
//   cin >> t;
//   Init();
//   for (ll i = 0; i < t; i++) {
//     char c, d; ll 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

/tmp/cckE2LuK.o: In function `main':
grader.cpp:(.text.startup+0x14b): undefined reference to `UndoCommands(int)'
grader.cpp:(.text.startup+0x177): undefined reference to `GetLetter(int)'
collect2: error: ld returned 1 exit status