Submission #530049

#TimeUsernameProblemLanguageResultExecution timeMemory
530049buidangnguyen05Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
/* input */ #include "cave.h" #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N = 5e3; int n; vector<int> done, state, que; int query(int cnt) { for (int i = 0; i < n; ++i) { if (done[i]) que[i] = state[i]; else if (cnt) que[i] = 1; else que[i] = 0; if (!done[i] && cnt) --cnt; } return tryCombination(que); } void exploreCave(int _n) { n = _n; done.resize(n); state.resize(n); que.resize(n); int prev = query(0); for (int i = 0; i < n; ++i) { int L = 0, R = n - 1, pos = 0; while (L <= R) { int mid = (L + R) >> 1; int cur = query(mid); if ((prev == i && cur > i) || (prev != i && cur == i)) { pos = mid; R = mid - 1; } else L = mid + 1; } if (prev == i) state[pos] = 1; done[pos] = i; prev = query(0); } answer(state, done); }

Compilation message (stderr)

cave.cpp: In function 'int query(int)':
cave.cpp:21:24: error: cannot convert 'std::vector<int>' to 'int*'
   21 |  return tryCombination(que);
      |                        ^~~
      |                        |
      |                        std::vector<int>
In file included from cave.cpp:5:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:42:9: error: cannot convert 'std::vector<int>' to 'int*'
   42 |  answer(state, done);
      |         ^~~~~
      |         |
      |         std::vector<int>
In file included from cave.cpp:5:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~