Submission #639163

#TimeUsernameProblemLanguageResultExecution timeMemory
639163BlagojceRarest Insects (IOI22_insects)C++17
Compilation error
0 ms0 KiB
#include <iostream> #include <algorithm> #include <vector> #include <map> #include <queue> #include <set> #include <unordered_map> #include <unordered_set> #include <string> #include <string.h> #include <bitset> #include <numeric> #include <utility> #include <random> #include <cassert> #define fr(i, n, m) for(int i = (n); i < (m); i ++) #define pb push_back #define st first #define nd second #define pq priority_queue #define all(x) begin(x), end(x) using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; const int mxn = 2e3; #include "insects.h" int n; vector<int> unique; bool dont_use[mxn]; void restrict_this(int x){ dont_use[x] = true; } void find_unique(){ fr(i, 0, n){ move_inside(i); int cnt = press_button(); if(cnt == 2){ move_outside(i); } else{ restrict_this(i); unique.pb(i); } } } bool histogram(int h){ int area = unique.size(); vector<int> v; fr(i, 0, n){ if(dont_use[i]) continue; move_inside(i); int cnt = press_button(); if(cnt > h){ move_outside(i); } else{ ++area; v.pb(i); } } for(auto i : v){ move_outside(i); } return area == h * unique.size(); } int min_cardinality(int N) { n = N; find_unique(); int l = 1, r = N; while(l < r){ int m = (l + r + 1)/2; if(histogram(m)){ l = m; } else{ r = m-1; } } return l; }

Compilation message (stderr)

insects.cpp: In function 'void find_unique()':
insects.cpp:51:13: error: reference to 'unique' is ambiguous
   51 |             unique.pb(i);
      |             ^~~~~~
In file included from /usr/include/c++/10/algorithm:74,
                 from insects.cpp:2:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:234:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator)'
  234 | unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
      | ^~~~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:230:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate)'
  230 | unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred);
      | ^~~~~~
In file included from /usr/include/c++/10/algorithm:62,
                 from insects.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:1004:5: note:                 'template<class _FIter, class _BinaryPredicate> _FIter std::unique(_FIter, _FIter, _BinaryPredicate)'
 1004 |     unique(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/10/bits/stl_algo.h:973:5: note:                 'template<class _FIter> _FIter std::unique(_FIter, _FIter)'
  973 |     unique(_ForwardIterator __first, _ForwardIterator __last)
      |     ^~~~~~
insects.cpp:34:13: note:                 'std::vector<int> unique'
   34 | vector<int> unique;
      |             ^~~~~~
insects.cpp: In function 'bool histogram(int)':
insects.cpp:57:16: error: reference to 'unique' is ambiguous
   57 |     int area = unique.size();
      |                ^~~~~~
In file included from /usr/include/c++/10/algorithm:74,
                 from insects.cpp:2:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:234:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator)'
  234 | unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
      | ^~~~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:230:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate)'
  230 | unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred);
      | ^~~~~~
In file included from /usr/include/c++/10/algorithm:62,
                 from insects.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:1004:5: note:                 'template<class _FIter, class _BinaryPredicate> _FIter std::unique(_FIter, _FIter, _BinaryPredicate)'
 1004 |     unique(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/10/bits/stl_algo.h:973:5: note:                 'template<class _FIter> _FIter std::unique(_FIter, _FIter)'
  973 |     unique(_ForwardIterator __first, _ForwardIterator __last)
      |     ^~~~~~
insects.cpp:34:13: note:                 'std::vector<int> unique'
   34 | vector<int> unique;
      |             ^~~~~~
insects.cpp:76:24: error: reference to 'unique' is ambiguous
   76 |     return area == h * unique.size();
      |                        ^~~~~~
In file included from /usr/include/c++/10/algorithm:74,
                 from insects.cpp:2:
/usr/include/c++/10/pstl/glue_algorithm_defs.h:234:1: note: candidates are: 'template<class _ExecutionPolicy, class _ForwardIterator> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator)'
  234 | unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last);
      | ^~~~~~
/usr/include/c++/10/pstl/glue_algorithm_defs.h:230:1: note:                 'template<class _ExecutionPolicy, class _ForwardIterator, class _BinaryPredicate> __pstl::__internal::__enable_if_execution_policy<_ExecutionPolicy, _ForwardIterator> std::unique(_ExecutionPolicy&&, _ForwardIterator, _ForwardIterator, _BinaryPredicate)'
  230 | unique(_ExecutionPolicy&& __exec, _ForwardIterator __first, _ForwardIterator __last, _BinaryPredicate __pred);
      | ^~~~~~
In file included from /usr/include/c++/10/algorithm:62,
                 from insects.cpp:2:
/usr/include/c++/10/bits/stl_algo.h:1004:5: note:                 'template<class _FIter, class _BinaryPredicate> _FIter std::unique(_FIter, _FIter, _BinaryPredicate)'
 1004 |     unique(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~
/usr/include/c++/10/bits/stl_algo.h:973:5: note:                 'template<class _FIter> _FIter std::unique(_FIter, _FIter)'
  973 |     unique(_ForwardIterator __first, _ForwardIterator __last)
      |     ^~~~~~
insects.cpp:34:13: note:                 'std::vector<int> unique'
   34 | vector<int> unique;
      |             ^~~~~~