# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1054398 | 2024-08-12T09:37:08 Z | j_vdd16 | Team Contest (JOI22_team) | C++17 | Compilation error |
0 ms | 0 KB |
#include <algorithm> #include <bitset> #include <cstdint> #include <cstring> #include <iostream> #include <limits.h> #include <math.h> #include <map> #include <numeric> #include <queue> #include <set> #include <stack> #include <string> #include <vector> //#define int long long #define loop(X, N) for(int X = 0; X < (N); X++) #define all(V) V.begin(), V.end() #define rall(V) V.rbegin(), V.rend() using namespace std; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef vector<vector<ii>> vvii; typedef vector<bool> vb; typedef vector<vector<bool>> vvb; int getMax(int* data, int size) { bool isSame = false; int best = 0; for (int i = 1; i < size; i++) { if (data[i] > data[best]) { best = i; isSame = false; } else if (data[i] == data[best]) isSame = true; } if (isSame) return -1; return best; } struct Beaver { int x, y, z; }; bool comp(const Beaver& a, const Beaver& b) { return a.x > b.x || (a.x == b.x && a.y > b.y) || (a.x == b.x && a.y == b.y && a.z > b.z); } signed main() { int n; cin >> n; set<Beaver> beaverSet; loop(i, n) { int x, y, z; cin >> x >> y >> z; beaverSet.insert(Beaver{x, y, z}); } vector<Beaver> beavers; for (auto beaver : beaverSet) beavers.push_back(beaver); sort(all(beavers), comp); int bestScore = -1; loop(i, n) { for (int j = i + 1; j < n; j++) { if (beavers[i].x == beavers[j].x) continue; for (int k = j + 1; k < n; k++) { int x[3] = { beavers[i].x, beavers[j].x, beavers[k].x }; int y[3] = { beavers[i].y, beavers[j].y, beavers[k].y }; int z[3] = { beavers[i].z, beavers[j].z, beavers[k].z }; int maxX = 0; int maxY = getMax(y, 3); int maxZ = getMax(z, 3); if (maxX == maxY || maxX == maxZ || maxY == maxZ || maxX == -1 || maxY == -1 || maxZ == -1) continue; bestScore = max(bestScore, x[maxX] + y[maxY] + z[maxZ]); } } } std::cout << bestScore << endl; return 0; }
Compilation message
In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h: In instantiation of 'constexpr bool std::less<_Tp>::operator()(const _Tp&, const _Tp&) const [with _Tp = Beaver]': /usr/include/c++/10/bits/stl_tree.h:2101:35: required from 'std::pair<std::_Rb_tree_node_base*, std::_Rb_tree_node_base*> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_get_insert_unique_pos(const key_type&) [with _Key = Beaver; _Val = Beaver; _KeyOfValue = std::_Identity<Beaver>; _Compare = std::less<Beaver>; _Alloc = std::allocator<Beaver>; std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::key_type = Beaver]' /usr/include/c++/10/bits/stl_tree.h:2154:4: required from 'std::pair<std::_Rb_tree_iterator<_Val>, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(_Arg&&) [with _Arg = Beaver; _Key = Beaver; _Val = Beaver; _KeyOfValue = std::_Identity<Beaver>; _Compare = std::less<Beaver>; _Alloc = std::allocator<Beaver>]' /usr/include/c++/10/bits/stl_set.h:521:25: required from 'std::pair<typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other>::const_iterator, bool> std::set<_Key, _Compare, _Alloc>::insert(std::set<_Key, _Compare, _Alloc>::value_type&&) [with _Key = Beaver; _Compare = std::less<Beaver>; _Alloc = std::allocator<Beaver>; typename std::_Rb_tree<_Key, _Key, std::_Identity<_Tp>, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<_Key>::other>::const_iterator = std::_Rb_tree<Beaver, Beaver, std::_Identity<Beaver>, std::less<Beaver>, std::allocator<Beaver> >::const_iterator; std::set<_Key, _Compare, _Alloc>::value_type = Beaver]' team.cpp:65:41: required from here /usr/include/c++/10/bits/stl_function.h:386:20: error: no match for 'operator<' (operand types are 'const Beaver' and 'const Beaver') 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/utility:70, from /usr/include/c++/10/algorithm:60, from team.cpp:1: /usr/include/c++/10/bits/stl_pair.h:489:5: note: candidate: 'template<class _T1, class _T2> constexpr bool std::operator<(const std::pair<_T1, _T2>&, const std::pair<_T1, _T2>&)' 489 | operator<(const pair<_T1, _T2>& __x, const pair<_T1, _T2>& __y) | ^~~~~~~~ /usr/include/c++/10/bits/stl_pair.h:489:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::pair<_T1, _T2>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/algorithm:61, from team.cpp:1: /usr/include/c++/10/bits/stl_iterator.h:366:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_Iterator>&)' 366 | operator<(const reverse_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:366:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::reverse_iterator<_Iterator>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/algorithm:61, from team.cpp:1: /usr/include/c++/10/bits/stl_iterator.h:404:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const std::reverse_iterator<_Iterator>&, const std::reverse_iterator<_IteratorR>&)' 404 | operator<(const reverse_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:404:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::reverse_iterator<_Iterator>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/algorithm:61, from team.cpp:1: /usr/include/c++/10/bits/stl_iterator.h:1451:5: note: candidate: 'template<class _IteratorL, class _IteratorR> constexpr bool std::operator<(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorR>&)' 1451 | operator<(const move_iterator<_IteratorL>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:1451:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::move_iterator<_IteratorL>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/stl_algobase.h:67, from /usr/include/c++/10/algorithm:61, from team.cpp:1: /usr/include/c++/10/bits/stl_iterator.h:1507:5: note: candidate: 'template<class _Iterator> constexpr bool std::operator<(const std::move_iterator<_IteratorL>&, const std::move_iterator<_IteratorL>&)' 1507 | operator<(const move_iterator<_Iterator>& __x, | ^~~~~~~~ /usr/include/c++/10/bits/stl_iterator.h:1507:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::move_iterator<_IteratorL>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/tuple:39, from /usr/include/c++/10/functional:54, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/array:284:5: note: candidate: 'template<class _Tp, long unsigned int _Nm> bool std::operator<(const std::array<_Tp, _Nm>&, const std::array<_Tp, _Nm>&)' 284 | operator<(const array<_Tp, _Nm>& __a, const array<_Tp, _Nm>& __b) | ^~~~~~~~ /usr/include/c++/10/array:284:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::array<_Tp, _Nm>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/functional:54, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/tuple:1435:5: note: candidate: 'template<class ... _TElements, class ... _UElements> constexpr bool std::operator<(const std::tuple<_Tps ...>&, const std::tuple<_UTypes ...>&)' 1435 | operator<(const tuple<_TElements...>& __t, | ^~~~~~~~ /usr/include/c++/10/tuple:1435:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::tuple<_Tps ...>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/node_handle.h:39, from /usr/include/c++/10/bits/hashtable.h:37, from /usr/include/c++/10/unordered_map:46, from /usr/include/c++/10/functional:61, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/optional:1003:5: note: candidate: 'template<class _Tp, class _Up> constexpr std::__optional_relop_t<decltype ((declval<_Tp>() < declval<_Up>()))> std::operator<(const std::optional<_Tp>&, const std::optional<_Up>&)' 1003 | operator<(const optional<_Tp>& __lhs, const optional<_Up>& __rhs) | ^~~~~~~~ /usr/include/c++/10/optional:1003:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::optional<_Tp>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/node_handle.h:39, from /usr/include/c++/10/bits/hashtable.h:37, from /usr/include/c++/10/unordered_map:46, from /usr/include/c++/10/functional:61, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/optional:1071:5: note: candidate: 'template<class _Tp> constexpr bool std::operator<(const std::optional<_Tp>&, std::nullopt_t)' 1071 | operator<(const optional<_Tp>& /* __lhs */, nullopt_t) noexcept | ^~~~~~~~ /usr/include/c++/10/optional:1071:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::optional<_Tp>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/node_handle.h:39, from /usr/include/c++/10/bits/hashtable.h:37, from /usr/include/c++/10/unordered_map:46, from /usr/include/c++/10/functional:61, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/optional:1076:5: note: candidate: 'template<class _Tp> constexpr bool std::operator<(std::nullopt_t, const std::optional<_Tp>&)' 1076 | operator<(nullopt_t, const optional<_Tp>& __rhs) noexcept | ^~~~~~~~ /usr/include/c++/10/optional:1076:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::optional<_Tp>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/node_handle.h:39, from /usr/include/c++/10/bits/hashtable.h:37, from /usr/include/c++/10/unordered_map:46, from /usr/include/c++/10/functional:61, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/optional:1137:5: note: candidate: 'template<class _Tp, class _Up> constexpr std::__optional_relop_t<decltype ((declval<_Tp>() < declval<_Up>()))> std::operator<(const std::optional<_Tp>&, const _Up&)' 1137 | operator<(const optional<_Tp>& __lhs, const _Up& __rhs) | ^~~~~~~~ /usr/include/c++/10/optional:1137:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::optional<_Tp>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/node_handle.h:39, from /usr/include/c++/10/bits/hashtable.h:37, from /usr/include/c++/10/unordered_map:46, from /usr/include/c++/10/functional:61, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/optional:1143:5: note: candidate: 'template<class _Tp, class _Up> constexpr std::__optional_relop_t<decltype ((declval<_Up>() < declval<_Tp>()))> std::operator<(const _Up&, const std::optional<_Tp>&)' 1143 | operator<(const _Up& __lhs, const optional<_Tp>& __rhs) | ^~~~~~~~ /usr/include/c++/10/optional:1143:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::optional<_Tp>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/vector:67, from /usr/include/c++/10/functional:62, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_vector.h:1930:5: note: candidate: 'template<class _Tp, class _Alloc> bool std::operator<(const std::vector<_Tp, _Alloc>&, const std::vector<_Tp, _Alloc>&)' 1930 | operator<(const vector<_Tp, _Alloc>& __x, const vector<_Tp, _Alloc>& __y) | ^~~~~~~~ /usr/include/c++/10/bits/stl_vector.h:1930:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'const Beaver' is not derived from 'const std::vector<_Tp, _Alloc>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/basic_string.h:48, from /usr/include/c++/10/string:55, from /usr/include/c++/10/bitset:47, from team.cpp:2: /usr/include/c++/10/string_view:544:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(std::basic_string_view<_CharT, _Traits>, std::basic_string_view<_CharT, _Traits>)' 544 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/10/string_view:544:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'Beaver' is not derived from 'std::basic_string_view<_CharT, _Traits>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/basic_string.h:48, from /usr/include/c++/10/string:55, from /usr/include/c++/10/bitset:47, from team.cpp:2: /usr/include/c++/10/string_view:550:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(std::basic_string_view<_CharT, _Traits>, std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >)' 550 | operator< (basic_string_view<_CharT, _Traits> __x, | ^~~~~~~~ /usr/include/c++/10/string_view:550:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from team.cpp:1: /usr/include/c++/10/bits/stl_function.h:386:20: note: 'Beaver' is not derived from 'std::basic_string_view<_CharT, _Traits>' 386 | { return __x < __y; } | ~~~~^~~~~ In file included from /usr/include/c++/10/bits/basic_string.h:48, from /usr/include/c++/10/string:55, from /usr/include/c++/10/bitset:47, from team.cpp:2: /usr/include/c++/10/string_view:557:5: note: candidate: 'template<class _CharT, class _Traits> constexpr bool std::operator<(std::__type_identity_t<std::basic_string_view<_CharT, _Traits> >, std::basic_string_view<_CharT, _Traits>)' 557 | operator< (__type_identity_t<basic_string_view<_CharT, _Traits>> __x, | ^~~~~~~~ /usr/include/c++/10/string_view:557:5: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/functional:49, from /usr/include/c++/10/pstl/glue_algorithm_defs.h:13, from /usr/include/c++/10/algorithm:74, from