Submission #975768

#TimeUsernameProblemLanguageResultExecution timeMemory
975768marinalucaCrayfish scrivener (IOI12_scrivener)C++14
Compilation error
0 ms0 KiB
char ans[1000010];
int a[1000010], rez[1000010], mat[20][1000010], t;
void Init(){}
void Typeletter (char L){
  int i;
    ans[a[++t] = t] = L;
    rez[t] = rez[mat[0][t] = v[t - 1]] + 1;
    for (i = 1; i < 20; ++ i)
        mat[i][t] = mat[i - 1][mat[i - 1][t]];
}
void UndoCommands(int U){a[++t] = a[t - U - 1];}

char GetLetter(int P){
    int aa = a[t], i;
    for ( i = 20; i --;)
        if (rez[mat[i][aa]] > P)
          aa = mat[i][aa];
    return ans[a];
}

Compilation message (stderr)

scrivener.cpp: In function 'void Typeletter(char)':
scrivener.cpp:7:30: error: 'v' was not declared in this scope
    7 |     rez[t] = rez[mat[0][t] = v[t - 1]] + 1;
      |                              ^
scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:11:28: warning: operation on 't' may be undefined [-Wsequence-point]
   11 | void UndoCommands(int U){a[++t] = a[t - U - 1];}
      |                            ^~~
scrivener.cpp:11:28: warning: operation on 't' may be undefined [-Wsequence-point]
scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:18:15: error: invalid types 'char [1000010][int [1000010]]' for array subscript
   18 |     return ans[a];
      |               ^