Submission #169300

#TimeUsernameProblemLanguageResultExecution timeMemory
169300AlexLuchianovCrayfish scrivener (IOI12_scrivener)C11
Compilation error
0 ms0 KiB
int const nmax = 1000000;

using ll = long long;
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))

char last;

int far[1 + nmax][20], ptr = 0;
int level[1 + nmax];
char chr[1 + nmax];

void Init() {}

void TypeLetter(char L) {
  ++ptr;
  far[ptr][0] = ptr - 1;
  for(int h = 1; h < 20; h++)
    far[ptr][h] = far[far[ptr][h - 1]][h - 1];
  level[ptr] = level[far[ptr][0]] + 1;
  chr[ptr] = L;
}

void UndoCommands(int U) {
  ++ptr;
  far[ptr][0] = ptr - 1 - U;
  for(int h = 1; h < 20; h++)
    far[ptr][h] = far[far[ptr][h - 1]][h - 1];
  level[ptr] = level[far[ptr][0]];
}

char GetLetter(int P) {
  int pos = ptr;
  P++;
  for(int h = 19; 0 <= h; h--)
    if(P <= level[far[pos][h]] )
      pos = far[pos][h];
  return chr[pos];
}

Compilation message (stderr)

scrivener.c:3:1: error: unknown type name 'using'
 using ll = long long;
 ^~~~~
scrivener.c:3:12: error: expected expression before 'long'
 using ll = long long;
            ^~~~
scrivener.c:9:5: error: variably modified 'far' at file scope
 int far[1 + nmax][20], ptr = 0;
     ^~~
scrivener.c:10:5: error: variably modified 'level' at file scope
 int level[1 + nmax];
     ^~~~~
scrivener.c:11:6: error: variably modified 'chr' at file scope
 char chr[1 + nmax];
      ^~~