Submission #390858

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

// Main
//	int tryCombination(int N, int S[])
//	void answer(int N, int S[], int D[])

//Sub-Tarea 5 (?)

void exploreCave(int N) {
  int S[N], D[N]; int last = 0; bool vis[N];
  for (int i = 0; i < N; i++) { 
    S[i] = 0; vis[i] = false;
  }
  while (last != -1) {
    last = tryCombination(N, S);
    for (int i = 0; i < N; i++) {
      if (vis[i]) continue;
      S[i] = (S[i] - 1)*(S[i] - 1);
      int aux = tryCombination(N, S);
      if (aux > last || aux == -1) {
        last = aux;
        break;
      }
      if (aux < last) vis[i] = false;
      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:15:27: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   15 |     last = tryCombination(N, S);
      |                           ^
      |                           |
      |                           int
cave.cpp:15:31: error: too many arguments to function 'int tryCombination(int*)'
   15 |     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:19:32: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   19 |       int aux = tryCombination(N, S);
      |                                ^
      |                                |
      |                                int
cave.cpp:19:36: error: too many arguments to function 'int tryCombination(int*)'
   19 |       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:30:27: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   30 |     D[i] = tryCombination(N,S);
      |                           ^
      |                           |
      |                           int
cave.cpp:30:30: error: too many arguments to function 'int tryCombination(int*)'
   30 |     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:33:10: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   33 |   answer(N, S, D);
      |          ^
      |          |
      |          int
cave.cpp:33:17: error: too many arguments to function 'void answer(int*, int*)'
   33 |   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[]);
      |      ^~~~~~