Submission #483236

#TimeUsernameProblemLanguageResultExecution timeMemory
483236syl123456Crayfish scrivener (IOI12_scrivener)C++17
Compilation error
0 ms0 KiB
vector<char> c; vector<int> dep, ptr; vector<vector<int>> pa, ch; void Init() { c.push_back('.'); dep.push_back(0); ptr.push_back(0); pa.emplace_back(20, 0); ch.emplace_back(26, -1); } void TypeLetter(char L) { int y = L - 'a', x = ptr.back(); if (ch[x][y] == -1) { int i = ch[x][y] = c.size(); c.push_back(L); dep.push_back(dep[x] + 1); pa.emplace_back(20); ch.emplace_back(26, -1); pa[i][0] = x; for (int j = 1; j < 20; ++j) pa[i][j] = pa[pa[i][j - 1]][j - 1]; } ptr.push_back(ch[t][x]); } void UndoCommands(int U) { int i = ptr.size() - 1 - U; ptr.push_back(ptr[i]); } char GetLetter(int P) { ++P; int i = ptr.back(); for (int j = 19; ~j; --j) if (dep[pa[i][j]] >= P) i = pa[i][j]; return c[i]; }

Compilation message (stderr)

scrivener.cpp:1:1: error: 'vector' does not name a type
    1 | vector<char> c;
      | ^~~~~~
scrivener.cpp:2:1: error: 'vector' does not name a type
    2 | vector<int> dep, ptr;
      | ^~~~~~
scrivener.cpp:3:1: error: 'vector' does not name a type
    3 | vector<vector<int>> pa, ch;
      | ^~~~~~
scrivener.cpp: In function 'void Init()':
scrivener.cpp:6:3: error: 'c' was not declared in this scope
    6 |   c.push_back('.');
      |   ^
scrivener.cpp:7:3: error: 'dep' was not declared in this scope
    7 |   dep.push_back(0);
      |   ^~~
scrivener.cpp:8:3: error: 'ptr' was not declared in this scope
    8 |   ptr.push_back(0);
      |   ^~~
scrivener.cpp:9:3: error: 'pa' was not declared in this scope
    9 |   pa.emplace_back(20, 0);
      |   ^~
scrivener.cpp:10:3: error: 'ch' was not declared in this scope; did you mean 'char'?
   10 |   ch.emplace_back(26, -1);
      |   ^~
      |   char
scrivener.cpp: In function 'void TypeLetter(char)':
scrivener.cpp:14:24: error: 'ptr' was not declared in this scope
   14 |   int y = L - 'a', x = ptr.back();
      |                        ^~~
scrivener.cpp:15:7: error: 'ch' was not declared in this scope
   15 |   if (ch[x][y] == -1) {
      |       ^~
scrivener.cpp:16:24: error: 'c' was not declared in this scope
   16 |     int i = ch[x][y] = c.size();
      |                        ^
scrivener.cpp:18:5: error: 'dep' was not declared in this scope
   18 |     dep.push_back(dep[x] + 1);
      |     ^~~
scrivener.cpp:19:5: error: 'pa' was not declared in this scope
   19 |     pa.emplace_back(20);
      |     ^~
scrivener.cpp:25:17: error: 'ch' was not declared in this scope
   25 |   ptr.push_back(ch[t][x]);
      |                 ^~
scrivener.cpp:25:20: error: 't' was not declared in this scope
   25 |   ptr.push_back(ch[t][x]);
      |                    ^
scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:29:11: error: 'ptr' was not declared in this scope
   29 |   int i = ptr.size() - 1 - U;
      |           ^~~
scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:35:11: error: 'ptr' was not declared in this scope
   35 |   int i = ptr.back();
      |           ^~~
scrivener.cpp:37:9: error: 'dep' was not declared in this scope
   37 |     if (dep[pa[i][j]] >= P)
      |         ^~~
scrivener.cpp:37:13: error: 'pa' was not declared in this scope
   37 |     if (dep[pa[i][j]] >= P)
      |             ^~
scrivener.cpp:39:10: error: 'c' was not declared in this scope
   39 |   return c[i];
      |          ^