Submission #988727

#TimeUsernameProblemLanguageResultExecution timeMemory
988727AriadnaCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { vector<int> pos(N, -1), door(N, -1); vector<int> s(N); for (int d = 0; d < N; ++d) { int correct_pos = 0; for (int i = 0; i < N; ++i) if (pos[i] != -1) s[i] = pos[i]; else s[i] = 0; if (tryCombination(s) == d) correct_pos = 1; int l = 0, r = N-1, ans; vector<int> s(N); while (l <= r) { int m = (l+r)/2; for (int i = 0; i < N; ++i) { if (pos[i] != -1) s[i] = pos[i]; else if (i < m) s[i] = correct_pos; else s[i] = 1-correct_pos; } int res = tryCombination(s); if (res > d || res == -1) { r = m-1; } else { ans = m; l = m+1; } } pos[ans] = correct_pos; door[ans] = d; } answer(pos, door); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:16:28: error: cannot convert 'std::vector<int>' to 'int*'
   16 |         if (tryCombination(s) == d) correct_pos = 1;
      |                            ^
      |                            |
      |                            std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:27:38: error: cannot convert 'std::vector<int>' to 'int*'
   27 |             int res = tryCombination(s);
      |                                      ^
      |                                      |
      |                                      std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:39:12: error: cannot convert 'std::vector<int>' to 'int*'
   39 |     answer(pos, door);
      |            ^~~
      |            |
      |            std::vector<int>
In file included from cave.cpp:1:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~