Submission #346644

#TimeUsernameProblemLanguageResultExecution timeMemory
346644PetyCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; const int N = 5000; bool found[N + 2]; int Switch[N + 2]; //int tryCombination (vector<int>s); int ask (int n, int mij, int state) { vector<int>s; for (int i = 0; i < n; i++) if (found[i]) s[i] = Switch[i]; else if (i <= mij) s[i] = state; else s[i] = 1 - state; return tryCombination(s); } void explore (int n) { vector<int>s; vector<int>d; s.resize(n); d.resize(n); for (int i = 0; i < n; i++) { bool state; if (ask(n, n - 1, 1) > i) state = 1; else state = 0; int st = 0, dr = n - 1, poz = 0; while (st <= dr) { int mij = (st + dr) / 2; int aux = ask(n, mij, state); if (aux > i || aux == -1) { dr = mij - 1; poz = mij; } else st = mij + 1; } d[poz] = i; s[poz] = state; found[poz] = 1; Switch[poz] = state; } answer(s, d); }

Compilation message (stderr)

cave.cpp: In function 'int ask(int, int, int)':
cave.cpp:22:25: error: cannot convert 'std::vector<int>' to 'int*'
   22 |   return tryCombination(s);
      |                         ^
      |                         |
      |                         std::vector<int>
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp: In function 'void explore(int)':
cave.cpp:52:10: error: cannot convert 'std::vector<int>' to 'int*'
   52 |   answer(s, d);
      |          ^
      |          |
      |          std::vector<int>
In file included from cave.cpp:2:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~