Submission #574952

#TimeUsernameProblemLanguageResultExecution timeMemory
574952birthdaycakeA Difficult(y) Choice (BOI21_books)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; long long b[200001]; void solve(int n, int k, long long a, int s) { set<int>v; int a1 = 0, a2 = 0, a3 = -1; for(int i = 0; i < n; i++) { b[i] = skim(i + 1); v.insert(b[i]); } for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ int tot = a - (b[i] + b[j]) - 1; auto x = v.upper_bound(tot); if(*x == b[i]) x = v.upper_bound(x); if(*x == b[j]) x = v.upper_bound(x); if(x != v.end()){ if(*x + b[i] + b[j] <= a * 2 && *x + b[i] + b[j] >= a ){ a1 = i; a2 = j; a3 = *x; } } } } for(int i = 0; i < n; i++){ if(a3 == b[i]){ vector<int>fin = {i + 1, a1 + 1, a2 + 1}; answer(fin); } } impossible(); }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:21:47: error: no matching function for call to 'std::set<int>::upper_bound(std::_Rb_tree_const_iterator<int>&)'
   21 |             if(*x == b[i]) x = v.upper_bound(x);
      |                                               ^
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_set.h:859:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::upper_bound(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::key_type = int]'
  859 |       upper_bound(const key_type& __x)
      |       ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:859:35: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const key_type&' {aka 'const int&'}
  859 |       upper_bound(const key_type& __x)
      |                   ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_set.h:863:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::upper_bound(const key_type&) const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::key_type = int]'
  863 |       upper_bound(const key_type& __x) const
      |       ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:863:35: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const key_type&' {aka 'const int&'}
  863 |       upper_bound(const key_type& __x) const
      |                   ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_set.h:869:2: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_upper_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::upper_bound(const _Kt&) [with _Kt = _Kt; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  869 |  upper_bound(const _Kt& __x)
      |  ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:869:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<int>::iterator)(((std::set<int>*)this)->std::set<int>::_M_t.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_upper_bound_tr(__x))) std::set<int>::upper_bound<_Kt>(const _Kt&) [with _Kt = std::_Rb_tree_const_iterator<int>]':
books.cpp:21:47:   required from here
/usr/include/c++/10/bits/stl_set.h:870:45: error: no matching function for call to 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_upper_bound_tr(const std::_Rb_tree_const_iterator<int>&)'
  870 |  -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
      |                       ~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/10/map:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_tree.h:1357:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
 1357 |  _M_upper_bound_tr(const _Kt& __k)
      |  ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_tree.h:1357:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_tree.h: In substitution of 'template<class _Cmp, class _SfinaeType> using __has_is_transparent_t = typename std::__has_is_transparent<_Cmp, _SfinaeType>::type [with _Cmp = std::less<int>; _SfinaeType = std::_Rb_tree_const_iterator<int>]':
/usr/include/c++/10/bits/stl_tree.h:1355:9:   required by substitution of 'template<class _Kt> decltype ((std::set<int>::iterator)(((std::set<int>*)this)->std::set<int>::_M_t.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_upper_bound_tr(__x))) std::set<int>::upper_bound<_Kt>(const _Kt&) [with _Kt = std::_Rb_tree_const_iterator<int>]'
books.cpp:21:47:   required from here
/usr/include/c++/10/bits/stl_tree.h:429:11: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<int>, std::_Rb_tree_const_iterator<int>, void>'
  429 |     using __has_is_transparent_t
      |           ^~~~~~~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<int>::iterator)(((std::set<int>*)this)->std::set<int>::_M_t.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_upper_bound_tr(__x))) std::set<int>::upper_bound<_Kt>(const _Kt&) [with _Kt = std::_Rb_tree_const_iterator<int>]':
books.cpp:21:47:   required from here
/usr/include/c++/10/bits/stl_tree.h:1366:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
 1366 |  _M_upper_bound_tr(const _Kt& __k) const
      |  ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_tree.h:1366:2: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_set.h:875:2: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_upper_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::upper_bound(const _Kt&) const [with _Kt = _Kt; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  875 |  upper_bound(const _Kt& __x) const
      |  ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:875:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<int>::iterator)(((const std::set<int>*)this)->std::set<int>::_M_t.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_upper_bound_tr(__x))) std::set<int>::upper_bound<_Kt>(const _Kt&) const [with _Kt = std::_Rb_tree_const_iterator<int>]':
books.cpp:21:47:   required from here
/usr/include/c++/10/bits/stl_set.h:876:45: error: no matching function for call to 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_upper_bound_tr(const std::_Rb_tree_const_iterator<int>&) const'
  876 |  -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
      |                       ~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/10/map:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_tree.h:1357:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
 1357 |  _M_upper_bound_tr(const _Kt& __k)
      |  ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_tree.h:1357:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_tree.h:1366:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
 1366 |  _M_upper_bound_tr(const _Kt& __k) const
      |  ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_tree.h:1366:2: note:   template argument deduction/substitution failed:
books.cpp:23:47: error: no matching function for call to 'std::set<int>::upper_bound(std::_Rb_tree_const_iterator<int>&)'
   23 |             if(*x == b[j]) x = v.upper_bound(x);
      |                                               ^
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_set.h:859:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::upper_bound(const key_type&) [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::key_type = int]'
  859 |       upper_bound(const key_type& __x)
      |       ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:859:35: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const key_type&' {aka 'const int&'}
  859 |       upper_bound(const key_type& __x)
      |                   ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_set.h:863:7: note: candidate: 'std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::upper_bound(const key_type&) const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator; std::set<_Key, _Compare, _Alloc>::key_type = int]'
  863 |       upper_bound(const key_type& __x) const
      |       ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:863:35: note:   no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<int>' to 'const key_type&' {aka 'const int&'}
  863 |       upper_bound(const key_type& __x) const
      |                   ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/10/bits/stl_set.h:869:2: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_upper_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::upper_bound(const _Kt&) [with _Kt = _Kt; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  869 |  upper_bound(const _Kt& __x)
      |  ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:869:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<int>::iterator)(((std::set<int>*)this)->std::set<int>::_M_t.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_upper_bound_tr(__x))) std::set<int>::upper_bound<_Kt>(const _Kt&) [with _Kt = std::_Rb_tree_const_iterator<int>]':
books.cpp:23:47:   required from here
/usr/include/c++/10/bits/stl_set.h:870:45: error: no matching function for call to 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_upper_bound_tr(const std::_Rb_tree_const_iterator<int>&)'
  870 |  -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
      |                       ~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/10/map:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_tree.h:1357:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
 1357 |  _M_upper_bound_tr(const _Kt& __k)
      |  ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_tree.h:1357:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_tree.h:1366:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
 1366 |  _M_upper_bound_tr(const _Kt& __k) const
      |  ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_tree.h:1366:2: note:   template argument deduction/substitution failed:
In file included from /usr/include/c++/10/set:61,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_set.h:875:2: note: candidate: 'template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::iterator)(((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_upper_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::upper_bound(const _Kt&) const [with _Kt = _Kt; _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
  875 |  upper_bound(const _Kt& __x) const
      |  ^~~~~~~~~~~
/usr/include/c++/10/bits/stl_set.h:875:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<int>::iterator)(((const std::set<int>*)this)->std::set<int>::_M_t.std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_upper_bound_tr(__x))) std::set<int>::upper_bound<_Kt>(const _Kt&) const [with _Kt = std::_Rb_tree_const_iterator<int>]':
books.cpp:23:47:   required from here
/usr/include/c++/10/bits/stl_set.h:876:45: error: no matching function for call to 'std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_M_upper_bound_tr(const std::_Rb_tree_const_iterator<int>&) const'
  876 |  -> decltype(iterator(_M_t._M_upper_bound_tr(__x)))
      |                       ~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from /usr/include/c++/10/map:60,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81,
                 from books.cpp:1:
/usr/include/c++/10/bits/stl_tree.h:1357:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
 1357 |  _M_upper_bound_tr(const _Kt& __k)
      |  ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_tree.h:1357:2: note:   template argument deduction/substitution failed:
/usr/include/c++/10/bits/stl_tree.h:1366:2: note: candidate: 'template<class _Kt, class _Req> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::const_iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_upper_bound_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = int; _Val = int; _KeyOfValue = std::_Identity<int>; _Compare = std::less<int>; _Alloc = std::allocator<int>]'
 1366 |  _M_upper_bound_tr(const _Kt& __k) const
      |  ^~~~~~~~~~~~~~~~~
/usr/include/c++/10/bits/stl_tree.h:1366:2: note:   template argument deduction/substitution failed: