Submission #766337

#TimeUsernameProblemLanguageResultExecution timeMemory
766337zsomborCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <vector> #include "cave.h" using namespace std; int n; vector <int> S; vector <int> D; vector <bool> done(5e3); void open_door(int d) { for (int i = 0; i < n; i++) if (!done[i]) S[i] = 0; int o = (tryCombination(S) != d ? 0 : 1), s = 0; for (int j = 0; j < 13; j++) { for (int i = 0; i < n; i++) if (!done[i]) S[i] = (i & (1 << j) ? o : 1 - o); if (tryCombination(S) != d) s += (1 << j); } S[s] = o; D[s] = d; done[s] = true; } void exploreCave(int N) { n = N; S.resize(n, 0); D.resize(n, 0); for (int i = 0; i < n; i++) open_door(i); answer(S, D); }

Compilation message (stderr)

cave.cpp: In function 'void open_door(int)':
cave.cpp:13:29: error: cannot convert 'std::vector<int>' to 'int*'
   13 |     int o = (tryCombination(S) != d ? 0 : 1), s = 0;
      |                             ^
      |                             |
      |                             std::vector<int>
In file included from cave.cpp:3:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:16:28: error: cannot convert 'std::vector<int>' to 'int*'
   16 |         if (tryCombination(S) != d) s += (1 << j);
      |                            ^
      |                            |
      |                            std::vector<int>
In file included from cave.cpp:3:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:16:37: error: 's' was not declared in this scope
   16 |         if (tryCombination(S) != d) s += (1 << j);
      |                                     ^
cave.cpp:18:7: error: 's' was not declared in this scope
   18 |     S[s] = o;
      |       ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:28:12: error: cannot convert 'std::vector<int>' to 'int*'
   28 |     answer(S, D);
      |            ^
      |            |
      |            std::vector<int>
In file included from cave.cpp:3:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~