Submission #373789

#TimeUsernameProblemLanguageResultExecution timeMemory
373789moratoRobots (IOI13_robots)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "robots.h" using namespace std; const int N = 1e6 + 5; const int M = 5e5 + 5; const int INF = 1e9; int a, b, t, x[M], y[M], ans; pair<int, int> toys[N]; bool check(int qtd) { priority_queue<pair<int, int>> pq; int ptr = 0; for (int i = 0; i < a; i++) { for (; ptr < t && toys[ptr].first < x[i]; ptr++) pq.emplace(toys[ptr].second, toys[ptr].first); for (int j = 0; j < qtd && !pq.empty(); j++) pq.pop(); } for (; ptr < t; ptr++) pq.emplace(toys[ptr].second, toys[ptr].first); for (int i = 0; i < b; i++) { for (int j = 0; j < qtd && !pq.empty(); j++) { if (pq.top() >= y[i]) return false; pq.pop(); } } return pq.empty(); } int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { a = A, b = B, t = T; for (int i = 0; i < a; i++) { x[i] = X[i]; } for (int i = 0; i < b; i++) { y[i] = Y[i]; } for (int i = 0; i < t; i++) { toys[i] = {W[i], S[i]}; } int l = 1, r = 1e6, best = -1; while (l <= r) { int m = (l + r) >> 1; if (check(m)) { best = m; r = m - 1; } else { l = m + 1; } } return best; }

Compilation message (stderr)

robots.cpp: In function 'bool check(int)':
robots.cpp:26:17: error: no match for 'operator>=' (operand types are 'const value_type' {aka 'const std::pair<int, int>'} and 'int')
   26 |    if (pq.top() >= y[i]) return false;
      |        ~~~~~~~~ ^~ ~~~~
      |              |        |
      |              |        int
      |              const value_type {aka const std::pair<int, int>}
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from robots.cpp:1:
/usr/include/c++/9/bits/regex.h:1070:5: note: candidate: 'template<class _BiIter> bool std::__cxx11::operator>=(const std::__cxx11::sub_match<_BiIter>&, const std::__cxx11::sub_match<_BiIter>&)'
 1070 |     operator>=(const sub_match<_BiIter>& __lhs, const sub_match<_BiIter>& __rhs)
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1070:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from robots.cpp:1:
/usr/include/c++/9/bits/regex.h:1148:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>=(std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&, const std::__cxx11::sub_match<_BiIter>&)'
 1148 |     operator>=(const __sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1148:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from robots.cpp:1:
/usr/include/c++/9/bits/regex.h:1222:5: note: candidate: 'template<class _Bi_iter, class _Ch_traits, class _Ch_alloc> bool std::__cxx11::operator>=(const std::__cxx11::sub_match<_BiIter>&, std::__cxx11::__sub_match_string<_Bi_iter, _Ch_traits, _Ch_alloc>&)'
 1222 |     operator>=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1222:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from robots.cpp:1:
/usr/include/c++/9/bits/regex.h:1296:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>=(const typename std::iterator_traits<_Iter>::value_type*, const std::__cxx11::sub_match<_BiIter>&)'
 1296 |     operator>=(typename iterator_traits<_Bi_iter>::value_type const* __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1296:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from robots.cpp:1:
/usr/include/c++/9/bits/regex.h:1370:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>=(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type*)'
 1370 |     operator>=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1370:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from robots.cpp:1:
/usr/include/c++/9/bits/regex.h:1447:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>=(const typename std::iterator_traits<_Iter>::value_type&, const std::__cxx11::sub_match<_BiIter>&)'
 1447 |     operator>=(typename iterator_traits<_Bi_iter>::value_type const& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1447:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   mismatched types 'const std::__cxx11::sub_match<_BiIter>' and 'int'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/regex:62,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:110,
                 from robots.cpp:1:
/usr/include/c++/9/bits/regex.h:1525:5: note: candidate: 'template<class _Bi_iter> bool std::__cxx11::operator>=(const std::__cxx11::sub_match<_BiIter>&, const typename std::iterator_traits<_Iter>::value_type&)'
 1525 |     operator>=(const sub_match<_Bi_iter>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/regex.h:1525:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::__cxx11::sub_match<_BiIter>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:64,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from robots.cpp:1:
/usr/include/c++/9/bits/stl_pair.h:479:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator>=(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)'
  479 |     operator>=(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_pair.h:479:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   mismatched types 'const std::pair<_T1, _T2>' and 'int'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from robots.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:355:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)'
  355 |     operator>=(const reverse_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:355:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from robots.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:393:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)'
  393 |     operator>=(const reverse_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:393:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::reverse_iterator<_Iterator>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from robots.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:1199:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator>=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)'
 1199 |     operator>=(const move_iterator<_IteratorL>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:1199:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::move_iterator<_IteratorL>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/bits/stl_algobase.h:67,
                 from /usr/include/c++/9/bits/specfun.h:45,
                 from /usr/include/c++/9/cmath:1927,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:41,
                 from robots.cpp:1:
/usr/include/c++/9/bits/stl_iterator.h:1205:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator>=(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)'
 1205 |     operator>=(const move_iterator<_Iterator>& __x,
      |     ^~~~~~~~
/usr/include/c++/9/bits/stl_iterator.h:1205:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::move_iterator<_IteratorL>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/bits/basic_string.h:48,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:1:
/usr/include/c++/9/string_view:563:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>=(std::basic_string_view<_CharT, _Traits>, std::basic_string_view<_CharT, _Traits>)'
  563 |     operator>=(basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/9/string_view:563:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'std::pair<int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/bits/basic_string.h:48,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:1:
/usr/include/c++/9/string_view:569:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>=(std::basic_string_view<_CharT, _Traits>, std::__detail::__idt<std::basic_string_view<_CharT, _Traits> >)'
  569 |     operator>=(basic_string_view<_CharT, _Traits> __x,
      |     ^~~~~~~~
/usr/include/c++/9/string_view:569:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'std::pair<int, int>' is not derived from 'std::basic_string_view<_CharT, _Traits>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/bits/basic_string.h:48,
                 from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:1:
/usr/include/c++/9/string_view:575:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator>=(std::__detail::__idt<std::basic_string_view<_CharT, _Traits> >, std::basic_string_view<_CharT, _Traits>)'
  575 |     operator>=(__detail::__idt<basic_string_view<_CharT, _Traits>> __x,
      |     ^~~~~~~~
/usr/include/c++/9/string_view:575:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   mismatched types 'std::basic_string_view<_CharT, _Traits>' and 'int'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6340:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6340 |     operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6340:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6353:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&, const _CharT*)'
 6353 |     operator>=(const basic_string<_CharT, _Traits, _Alloc>& __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6353:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/string:55,
                 from /usr/include/c++/9/bits/locale_classes.h:40,
                 from /usr/include/c++/9/bits/ios_base.h:41,
                 from /usr/include/c++/9/ios:42,
                 from /usr/include/c++/9/istream:38,
                 from /usr/include/c++/9/sstream:38,
                 from /usr/include/c++/9/complex:45,
                 from /usr/include/c++/9/ccomplex:39,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:54,
                 from robots.cpp:1:
/usr/include/c++/9/bits/basic_string.h:6365:5: note: candidate: 'template<class _CharT, class _Traits, class _Alloc> bool std::operator>=(const _CharT*, const std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)'
 6365 |     operator>=(const _CharT* __lhs,
      |     ^~~~~~~~
/usr/include/c++/9/bits/basic_string.h:6365:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   mismatched types 'const _CharT*' and 'std::pair<int, int>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/tuple:39,
                 from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from robots.cpp:1:
/usr/include/c++/9/array:280:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> bool std::operator>=(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)'
  280 |     operator>=(const array<_Tp, _Nm>& __one, const array<_Tp, _Nm>& __two)
      |     ^~~~~~~~
/usr/include/c++/9/array:280:5: note:   template argument deduction/substitution failed:
robots.cpp:26:23: note:   'const value_type' {aka 'const std::pair<int, int>'} is not derived from 'const std::array<_Tp, _Nm>'
   26 |    if (pq.top() >= y[i]) return false;
      |                       ^
In file included from /usr/include/c++/9/functional:54,
                 from /usr/include/c++/9/pstl/glue_algorithm_defs.h:13,
                 from /usr/include/c++/9/algorithm:71,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:65,
                 from /var/local/lib/isolate