| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1357782 | po_rag526 | A Plus B (IOI23_aplusb) | C++20 | Compilation error | 0 ms | 0 KiB |
#include "aplusb.h"
#include <bits/stdc++.h>
using namespace std;
struct what{
int p1,p2,a;
bool operator<(const what&o) {
return a>o.a;
}
};
vector<int> smallest_sums(int N, vector<int> A, vector<int> B) {
vector<int> ans;
priority_queue<what> pq;
int x;
pq.push({0,0,A[0]+B[0]});
for(int i = 1 ; i<=N ; ++i) {
auto get = pq.top();pq.pop();
ans.push_back(get.a);
if(get.p1 != N-1) pq.push({get.p1+1,get.p2,A[get.p1+1]+B[get.p2]});
if(get.p2 != N-1) pq.push({get.p1,get.p2+1,A[get.p1]+B[get.p2+1]});
}
return ans;
}
Compilation message (stderr)
In file included from /usr/include/c++/13/bits/refwrap.h:39,
from /usr/include/c++/13/vector:68,
from aplusb.h:1,
from aplusb.cpp:1:
/usr/include/c++/13/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = what]':
/usr/include/c++/13/bits/predefined_ops.h:196:23: required from 'constexpr bool __gnu_cxx::__ops::_Iter_comp_val<_Compare>::operator()(_Iterator, _Value&) [with _Iterator = __gnu_cxx::__normal_iterator<what*, std::vector<what, std::allocator<what> > >; _Value = what; _Compare = std::less<what>]'
/usr/include/c++/13/bits/stl_heap.h:140:48: required from 'constexpr void std::__push_heap(_RandomAccessIterator, _Distance, _Distance, _Tp, _Compare&) [with _RandomAccessIterator = __gnu_cxx::__normal_iterator<what*, vector<what, allocator<what> > >; _Distance = long int; _Tp = what; _Compare = __gnu_cxx::__ops::_Iter_comp_val<less<what> >]'
/usr/include/c++/13/bits/stl_heap.h:216:23: required from 'constexpr void std::push_heap(_RAIter, _RAIter, _Compare) [with _RAIter = __gnu_cxx::__normal_iterator<what*, vector<what, allocator<what> > >; _Compare = less<what>]'
/usr/include/c++/13/bits/stl_queue.h:749:16: required from 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(value_type&&) [with _Tp = what; _Sequence = std::vector<what, std::allocator<what> >; _Compare = std::less<what>; value_type = what]'
aplusb.cpp:14:9: required from here
/usr/include/c++/13/bits/stl_function.h:408:20: error: no match for 'operator<' (operand types are 'const what' and 'const what')
408 | { return __x < __y; }
| ~~~~^~~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:67,
from /usr/include/c++/13/vector:62:
/usr/include/c++/13/bits/stl_iterator.h:583:5: note: candidate: 'template<class _IteratorL, class _IteratorR> requires three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&)' (reversed)
583 | operator<=>(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:583:5: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_function.h:408:20: note: 'const what' is not derived from 'const std::reverse_iterator<_IteratorL>'
408 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/13/bits/stl_iterator.h:1690:5: note: candidate: 'template<class _IteratorL, class _IteratorR> requires three_way_comparable_with<_IteratorR, _IteratorL, std::partial_ordering> constexpr std::compare_three_way_result_t<_IteratorL, _IteratorR> std::operator<=>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&)' (reversed)
1690 | operator<=>(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1690:5: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_function.h:408:20: note: 'const what' is not derived from 'const std::move_iterator<_IteratorL>'
408 | { return __x < __y; }
| ~~~~^~~~~
In file included from /usr/include/c++/13/bits/stl_algobase.h:64:
/usr/include/c++/13/bits/stl_pair.h:819:5: note: candidate: 'template<class _T1, class _T2> constexpr std::common_comparison_category_t<decltype (std::__detail::__synth3way(declval<_T1&>(), declval<_T1&>())), decltype (std::__detail::__synth3way(declval<_T2&>(), declval<_T2&>()))> std::operator<=>(const pair<_T1, _T2>&, const pair<_T1, _T2>&)' (rewritten)
819 | operator<=>(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y)
| ^~~~~~~~
/usr/include/c++/13/bits/stl_pair.h:819:5: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_function.h:408:20: note: 'const what' is not derived from 'const std::pair<_T1, _T2>'
408 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/13/bits/stl_iterator.h:601:5: note: candidate: 'template<class _Iterator> requires three_way_comparable<_Iterator, std::partial_ordering> constexpr std::compare_three_way_result_t<_Iterator, _Iterator> std::operator<=>(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorL>&)' (rewritten)
601 | operator<=>(const reverse_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:601:5: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_function.h:408:20: note: 'const what' is not derived from 'const std::reverse_iterator<_IteratorL>'
408 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/13/bits/stl_iterator.h:1756:5: note: candidate: 'template<class _Iterator> requires three_way_comparable<_Iterator, std::partial_ordering> constexpr std::compare_three_way_result_t<_Iterator, _Iterator> std::operator<=>(const move_iterator<_IteratorL>&, const move_iterator<_IteratorL>&)' (rewritten)
1756 | operator<=>(const move_iterator<_Iterator>& __x,
| ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1756:5: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_function.h:408:20: note: 'const what' is not derived from 'const std::move_iterator<_IteratorL>'
408 | { return __x < __y; }
| ~~~~^~~~~
In file included from /usr/include/c++/13/vector:66:
/usr/include/c++/13/bits/stl_vector.h:2059:5: note: candidate: 'template<class _Tp, class _Alloc> constexpr std::__detail::__synth3way_t<_T1> std::operator<=>(const vector<_Tp, _Alloc>&, const vector<_Tp, _Alloc>&)' (rewritten)
2059 | operator<=>(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y)
| ^~~~~~~~
/usr/include/c++/13/bits/stl_vector.h:2059:5: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_function.h:408:20: note: 'const what' is not derived from 'const std::vector<_Tp, _Alloc>'
408 | { return __x < __y; }
| ~~~~^~~~~
aplusb.cpp:6:14: note: candidate: 'bool what::operator<(const what&)' (near match)
6 | bool operator<(const what&o) {
| ^~~~~~~~
aplusb.cpp:6:14: note: passing 'const what*' as 'this' argument discards qualifiers
/usr/include/c++/13/bits/stl_iterator.h:550:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const reverse_iterator<_IteratorL>&, const reverse_iterator<_IteratorR>&) requires requires{{std::operator<::__x->base() > std::operator<::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}'
550 | operator<(const reverse_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:550:5: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_function.h:408:20: note: 'const what' is not derived from 'const std::reverse_iterator<_IteratorL>'
408 | { return __x < __y; }
| ~~~~^~~~~
/usr/include/c++/13/bits/stl_iterator.h:1705:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const move_iterator<_IteratorL>&, const move_iterator<_IteratorR>&) requires requires{{std::operator<::__x->base() < std::operator<::__y->base()} -> decltype(auto) [requires std::convertible_to<<placeholder>, bool>];}'
1705 | operator<(const move_iterator<_IteratorL>& __x,
| ^~~~~~~~
/usr/include/c++/13/bits/stl_iterator.h:1705:5: note: template argument deduction/substitution failed:
/usr/include/c++/13/bits/stl_function.h:408:20: note: 'const what' is not derived from 'const std::move_iterator<_IteratorL>'
408 | { return __x < __y; }
| ~~~~^~~~~