Submission #1021172

#TimeUsernameProblemLanguageResultExecution timeMemory
1021172aufanCrayfish scrivener (IOI12_scrivener)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; void Init() {} int p[1111111][22], sz[1111111], id = 0; char c[1111111]; void TypeLetter(char l) { id += 1; c[id] = l; p[id][0] = id - 1; sz[id] = sz[id - 1] + 1; for (int i = 1; i < 20; i++) { p[id][i] = p[p[id][i - 1]][i - 1]; } } void UndoCommands(int u) { id += 1; c[id] = c[id - u - 1]; sz[id] = sz[id - u - 1]; for (int i = 0; i < 20; i++) { p[id][i] = p[id - u - 1][i]; } } char GetLetter(int p) { int d = sz[id] - (p + 1), cur = id; for (int i = 0; i < 20; i++) { if (d >> i & 1) { cur = p[cur][i]; } } return c[cur]; }

Compilation message (stderr)

scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:33:14: error: invalid types 'int[int]' for array subscript
   33 |       cur = p[cur][i];
      |              ^