Submission #995060

#TimeUsernameProblemLanguageResultExecution timeMemory
995060otariusLibrary (JOI18_library)C++17
Compilation error
0 ms0 KiB
#include "library.h" #include <bits/stdc++.h> using namespace std; #define ff first #define sc second #define pb push_back #define pii pair<int, int> void Solve(int n) { vector<int> ans(n + 1); vector<bool> v(n, 1); for (int i = 1; i <= n; i++) { v[i - 1] = 0; if (Query(v) == 1) { ans[1] = i; break; } v[i - 1] = 1; } bool used[n + 1]; used[ans[1]] = 1; for (int i = 2; i <= n; i++) { vector<int> cur; for (int j = 1; j <= n; j++) if (!used[j]) cur.pb(j); int l = 0, r = cur.size() - 1, m, an; while (l <= r) { m = (l + r) / 2; vector<bool> bl(n, 0); bl[ans[i - 1]] = 1; for (int k = 0; k <= m; k++) bl[cur[k]] = 1; int vl = Query(bl); bl[ans[i - 1]] = 0; int now = Query(bl); if (vl != now) l = m + 1; else { an = m; r = m - 1; } } ans[i] = an; used[an] = 1; } ans.erase(ans.begin()); Answer(ans); }

Compilation message (stderr)

library.cpp: In function 'void Solve(int)':
library.cpp:14:19: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<bool>'
   14 |         if (Query(v) == 1) {
      |                   ^
In file included from library.cpp:1:
library.h:2:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    2 | int Query(const std::vector<int>& M);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^
library.cpp:30:28: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<bool>'
   30 |             int vl = Query(bl);
      |                            ^~
In file included from library.cpp:1:
library.h:2:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    2 | int Query(const std::vector<int>& M);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^
library.cpp:32:29: error: invalid initialization of reference of type 'const std::vector<int>&' from expression of type 'std::vector<bool>'
   32 |             int now = Query(bl);
      |                             ^~
In file included from library.cpp:1:
library.h:2:35: note: in passing argument 1 of 'int Query(const std::vector<int>&)'
    2 | int Query(const std::vector<int>& M);
      |           ~~~~~~~~~~~~~~~~~~~~~~~~^