Submission #1212555

#TimeUsernameProblemLanguageResultExecution timeMemory
1212555dima2101Super Dango Maker (JOI22_dango3)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "dango3.h" int GetMax(const std::vector<int> &x, int n, int m) { std::vector<bool> used(n * m + 1, false); for (int i : x) { used[x] = true; } std::vector<int> now; for (int i = 0; i < n * m; i++) { if (!used[i + 1]) { now.push_back(i + 1); } } return m - Query(now); } void Solve(int n, int m) { std::vector<std::vector<int>> ans(m); for (int i = 1; i <= n * m; i++) { int l = -1, r = m; while (l + 1 < r) { int mid = (l + r) / 2; ans[mid].push_back(i); if (GetMax(ans[mid], n, m) == 2) { l = mid; } else { r = mid; } ans[mid].pop_back(); } // assert(r != m); ans[r].push_back(i); } for (int i = 0; i < m; i++) { Answer(ans[i]); } }

Compilation message (stderr)

dango3.cpp: In function 'int GetMax(const std::vector<int>&, int, int)':
dango3.cpp:10:13: error: no match for 'operator[]' (operand types are 'std::vector<bool>' and 'const std::vector<int>')
   10 |         used[x] = true;
      |             ^
In file included from /usr/include/c++/11/vector:68,
                 from /usr/include/c++/11/functional:62,
                 from /usr/include/c++/11/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/11/algorithm:74,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:65,
                 from dango3.cpp:1:
/usr/include/c++/11/bits/stl_bvector.h:906:7: note: candidate: 'std::vector<bool, _Alloc>::reference std::vector<bool, _Alloc>::operator[](std::vector<bool, _Alloc>::size_type) [with _Alloc = std::allocator<bool>; std::vector<bool, _Alloc>::reference = std::vector<bool>::reference; std::vector<bool, _Alloc>::size_type = long unsigned int]'
  906 |       operator[](size_type __n)
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_bvector.h:906:28: note:   no known conversion for argument 1 from 'const std::vector<int>' to 'std::vector<bool>::size_type' {aka 'long unsigned int'}
  906 |       operator[](size_type __n)
      |                  ~~~~~~~~~~^~~
/usr/include/c++/11/bits/stl_bvector.h:910:7: note: candidate: 'std::vector<bool, _Alloc>::const_reference std::vector<bool, _Alloc>::operator[](std::vector<bool, _Alloc>::size_type) const [with _Alloc = std::allocator<bool>; std::vector<bool, _Alloc>::const_reference = bool; std::vector<bool, _Alloc>::size_type = long unsigned int]'
  910 |       operator[](size_type __n) const
      |       ^~~~~~~~
/usr/include/c++/11/bits/stl_bvector.h:910:28: note:   no known conversion for argument 1 from 'const std::vector<int>' to 'std::vector<bool>::size_type' {aka 'long unsigned int'}
  910 |       operator[](size_type __n) const
      |                  ~~~~~~~~~~^~~