Submission #390862

#TimeUsernameProblemLanguageResultExecution timeMemory
390862jampmCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h"

void exploreCave(int N) {
  int S[N], D[N]; int last = 0;
  for (int i = 0; i < N; i++) S[i] = 0;
  while (last != -1) {
    last = tryCombination(N, S);
    for (int i = 0; i < N; i++) {
      S[i] = (S[i] - 1)*(S[i] - 1);
      int aux = tryCombination(N, S);
      if (aux > last || aux == -1) {
        last = aux;
        break;
      }
      S[i] = (S[i] - 1)*(S[i] - 1);
    }
  }
  for (int i = 0; i < N; i++) {
    S[i] = (S[i] - 1)*(S[i] - 1);
    D[i] = tryCombination(N,S);
    S[i] = (S[i] - 1)*(S[i] - 1);
  }
  answer(N, S, D);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:7:27: error: invalid conversion from 'int' to 'int*' [-fpermissive]
    7 |     last = tryCombination(N, S);
      |                           ^
      |                           |
      |                           int
cave.cpp:7:31: error: too many arguments to function 'int tryCombination(int*)'
    7 |     last = tryCombination(N, S);
      |                               ^
In file included from cave.cpp:1:
cave.h:8:5: note: declared here
    8 | int tryCombination(int S[]);
      |     ^~~~~~~~~~~~~~
cave.cpp:10:32: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   10 |       int aux = tryCombination(N, S);
      |                                ^
      |                                |
      |                                int
cave.cpp:10:36: error: too many arguments to function 'int tryCombination(int*)'
   10 |       int aux = tryCombination(N, S);
      |                                    ^
In file included from cave.cpp:1:
cave.h:8:5: note: declared here
    8 | int tryCombination(int S[]);
      |     ^~~~~~~~~~~~~~
cave.cpp:20:27: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   20 |     D[i] = tryCombination(N,S);
      |                           ^
      |                           |
      |                           int
cave.cpp:20:30: error: too many arguments to function 'int tryCombination(int*)'
   20 |     D[i] = tryCombination(N,S);
      |                              ^
In file included from cave.cpp:1:
cave.h:8:5: note: declared here
    8 | int tryCombination(int S[]);
      |     ^~~~~~~~~~~~~~
cave.cpp:23:10: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   23 |   answer(N, S, D);
      |          ^
      |          |
      |          int
cave.cpp:23:17: error: too many arguments to function 'void answer(int*, int*)'
   23 |   answer(N, S, D);
      |                 ^
In file included from cave.cpp:1:
cave.h:9:6: note: declared here
    9 | void answer(int S[], int D[]);
      |      ^~~~~~