Submission #975743

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
9757432024-05-05 19:55:57marinalucaCrayfish scrivener (IOI12_scrivener)C++14
Compilation error
0 ms0 KiB
const int NMAX = 1e6 + 10;
const int VMAX = 10;
int v[NMAX], k, rez[NMAX], mat[VMAX + 10][NMAX];
char ans[NMAX];
void init(){
}
void Typeletter (char L){
ans[v[++ k] = k] = L;
rez[k] = rez[mat[0][k] = v[k - 1]] + 1;
for (int i = 1; i < 20; ++ i){
mat[i][k] = mat[i - 1][mat[i - 1][k]];
}
}
void UndoCommands(int U){
v[++ k] = v[k - P - 1];
}
char GetLetter(int P){
int a = v[k];
for (int i = 20; i --){
if (rez[mat[i][a]] > P)
a = mat[i][a];
}
return ans[a];
}
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

scrivener.cpp: In function 'void UndoCommands(int)':
scrivener.cpp:16:21: error: 'P' was not declared in this scope
   16 |     v[++ k] = v[k - P - 1];
      |                     ^
scrivener.cpp: In function 'char GetLetter(int)':
scrivener.cpp:20:26: error: expected ';' before ')' token
   20 |     for (int i = 20; i --){
      |                          ^
      |                          ;