# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
986456 | 2024-05-20T15:15:12 Z | LOLOLO | Hotel (CEOI11_hot) | C++14 | Compilation error |
0 ms | 0 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define f first #define s second #define pb push_back #define ep emplace #define eb emplace_back #define lb lower_bound #define ub upper_bound #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define uniquev(v) sort(all(v)), (v).resize(unique(all(v)) - (v).begin()) #define mem(f,x) memset(f , x , sizeof(f)) #define sz(x) (int)(x).size() #define __lcm(a, b) (1ll * ((a) / __gcd((a), (b))) * (b)) #define mxx *max_element #define mnn *min_element #define cntbit(x) __builtin_popcountll(x) #define len(x) (int)(x.length()) const int N = 2e5 + 10; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n, m, o; cin >> n >> m >> o; multiset <pair <int, int>> st; for (int i = 0; i < n; i++) { int a, b; cin >> a >> b; st.insert({b, a}); } vector <pair <int, int>> save; for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; save.pb({a, b}); } vector <ll> dis; sort(all(save), greater <pair <int, int>> ()); for (auto x : save) { auto it = st.lower_bound({x.s, -1e9}); if (it == st.end()) continue; ll diff = x.f - it->second; dis.pb(diff); st.erase(st.find(it)); } ll ans = 0; sort(all(dis), greater <ll> ()); for (int i = 0; i < min(sz(dis), o); i++) { ans += max(dis[i], (ll)0); } cout << ans << '\n'; return 0; }
Compilation message
hot.cpp: In function 'int main()': hot.cpp:57:28: error: no matching function for call to 'std::multiset<std::pair<int, int> >::find(std::_Rb_tree_const_iterator<std::pair<int, int> >&)' 57 | st.erase(st.find(it)); | ^ In file included from /usr/include/c++/10/set:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from hot.cpp:1: /usr/include/c++/10/bits/stl_multiset.h:775:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::iterator std::multiset<_Key, _Compare, _Alloc>::find(const key_type&) [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<int, int> > >::const_iterator; std::multiset<_Key, _Compare, _Alloc>::key_type = std::pair<int, int>]' 775 | find(const key_type& __x) | ^~~~ /usr/include/c++/10/bits/stl_multiset.h:775:28: note: no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<std::pair<int, int> >' to 'const key_type&' {aka 'const std::pair<int, int>&'} 775 | find(const key_type& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_multiset.h:779:7: note: candidate: 'std::multiset<_Key, _Compare, _Alloc>::const_iterator std::multiset<_Key, _Compare, _Alloc>::find(const key_type&) const [with _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<int, int> > >::const_iterator; std::multiset<_Key, _Compare, _Alloc>::key_type = std::pair<int, int>]' 779 | find(const key_type& __x) const | ^~~~ /usr/include/c++/10/bits/stl_multiset.h:779:28: note: no known conversion for argument 1 from 'std::_Rb_tree_const_iterator<std::pair<int, int> >' to 'const key_type&' {aka 'const std::pair<int, int>&'} 779 | find(const key_type& __x) const | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/10/bits/stl_multiset.h:785:2: note: candidate: 'template<class _Kt> decltype (std::multiset<_Key, _Compare, _Alloc>::iterator{((std::multiset<_Key, _Compare, _Alloc>*)this)->std::multiset<_Key, _Compare, _Alloc>::_M_t._M_find_tr(__x)}) std::multiset<_Key, _Compare, _Alloc>::find(const _Kt&) [with _Kt = _Kt; _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]' 785 | find(const _Kt& __x) | ^~~~ /usr/include/c++/10/bits/stl_multiset.h:785:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_multiset.h: In substitution of 'template<class _Kt> decltype (std::multiset<std::pair<int, int> >::iterator{((std::multiset<std::pair<int, int> >*)this)->std::multiset<std::pair<int, int> >::_M_t.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<int, int> > >::_M_find_tr(__x)}) std::multiset<std::pair<int, int> >::find<_Kt>(const _Kt&) [with _Kt = std::_Rb_tree_const_iterator<std::pair<int, int> >]': hot.cpp:57:28: required from here /usr/include/c++/10/bits/stl_multiset.h:786:38: error: no matching function for call to 'std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<int, int> > >::_M_find_tr(const std::_Rb_tree_const_iterator<std::pair<int, int> >&)' 786 | -> decltype(iterator{_M_t._M_find_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 hot.cpp:1: /usr/include/c++/10/bits/stl_tree.h:1301: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_find_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]' 1301 | _M_find_tr(const _Kt& __k) | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1301: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<std::pair<int, int> >; _SfinaeType = std::_Rb_tree_const_iterator<std::pair<int, int> >]': /usr/include/c++/10/bits/stl_tree.h:1299:9: required by substitution of 'template<class _Kt> decltype (std::multiset<std::pair<int, int> >::iterator{((std::multiset<std::pair<int, int> >*)this)->std::multiset<std::pair<int, int> >::_M_t.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<int, int> > >::_M_find_tr(__x)}) std::multiset<std::pair<int, int> >::find<_Kt>(const _Kt&) [with _Kt = std::_Rb_tree_const_iterator<std::pair<int, int> >]' hot.cpp:57:28: 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<std::pair<int, int> >, std::_Rb_tree_const_iterator<std::pair<int, int> >, void>' 429 | using __has_is_transparent_t | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_multiset.h: In substitution of 'template<class _Kt> decltype (std::multiset<std::pair<int, int> >::iterator{((std::multiset<std::pair<int, int> >*)this)->std::multiset<std::pair<int, int> >::_M_t.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<int, int> > >::_M_find_tr(__x)}) std::multiset<std::pair<int, int> >::find<_Kt>(const _Kt&) [with _Kt = std::_Rb_tree_const_iterator<std::pair<int, int> >]': hot.cpp:57:28: required from here /usr/include/c++/10/bits/stl_tree.h:1310: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_find_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]' 1310 | _M_find_tr(const _Kt& __k) const | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1310:2: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/set:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from hot.cpp:1: /usr/include/c++/10/bits/stl_multiset.h:785:2: error: no matching function for call to 'std::_Rb_tree_const_iterator<std::pair<int, int> >::_Rb_tree_const_iterator(<brace-enclosed initializer list>)' 785 | find(const _Kt& __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 hot.cpp:1: /usr/include/c++/10/bits/stl_tree.h:350:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator(const iterator&) [with _Tp = std::pair<int, int>; std::_Rb_tree_const_iterator<_Tp>::iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >::iterator]' 350 | _Rb_tree_const_iterator(const iterator& __it) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:350:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/10/bits/stl_tree.h:347:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator(std::_Rb_tree_const_iterator<_Tp>::_Base_ptr) [with _Tp = std::pair<int, int>; std::_Rb_tree_const_iterator<_Tp>::_Base_ptr = const std::_Rb_tree_node_base*]' 347 | _Rb_tree_const_iterator(_Base_ptr __x) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:347:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/10/bits/stl_tree.h:343:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator() [with _Tp = std::pair<int, int>]' 343 | _Rb_tree_const_iterator() _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:343:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/10/bits/stl_tree.h:328:12: note: candidate: 'constexpr std::_Rb_tree_const_iterator<std::pair<int, int> >::_Rb_tree_const_iterator(const std::_Rb_tree_const_iterator<std::pair<int, int> >&)' 328 | struct _Rb_tree_const_iterator | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:328:12: note: conversion of argument 1 would be ill-formed: /usr/include/c++/10/bits/stl_tree.h:328:12: note: candidate: 'constexpr std::_Rb_tree_const_iterator<std::pair<int, int> >::_Rb_tree_const_iterator(std::_Rb_tree_const_iterator<std::pair<int, int> >&&)' /usr/include/c++/10/bits/stl_tree.h:328:12: note: conversion of argument 1 would be ill-formed: In file included from /usr/include/c++/10/set:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from hot.cpp:1: /usr/include/c++/10/bits/stl_multiset.h:791:2: note: candidate: 'template<class _Kt> decltype (std::multiset<_Key, _Compare, _Alloc>::const_iterator{((const std::multiset<_Key, _Compare, _Alloc>*)this)->std::multiset<_Key, _Compare, _Alloc>::_M_t._M_find_tr(__x)}) std::multiset<_Key, _Compare, _Alloc>::find(const _Kt&) const [with _Kt = _Kt; _Key = std::pair<int, int>; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]' 791 | find(const _Kt& __x) const | ^~~~ /usr/include/c++/10/bits/stl_multiset.h:791:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_multiset.h: In substitution of 'template<class _Kt> decltype (std::multiset<std::pair<int, int> >::const_iterator{((const std::multiset<std::pair<int, int> >*)this)->std::multiset<std::pair<int, int> >::_M_t.std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<int, int> > >::_M_find_tr(__x)}) std::multiset<std::pair<int, int> >::find<_Kt>(const _Kt&) const [with _Kt = std::_Rb_tree_const_iterator<std::pair<int, int> >]': hot.cpp:57:28: required from here /usr/include/c++/10/bits/stl_multiset.h:792:44: error: no matching function for call to 'std::_Rb_tree<std::pair<int, int>, std::pair<int, int>, std::_Identity<std::pair<int, int> >, std::less<std::pair<int, int> >, std::allocator<std::pair<int, int> > >::_M_find_tr(const std::_Rb_tree_const_iterator<std::pair<int, int> >&) const' 792 | -> decltype(const_iterator{_M_t._M_find_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 hot.cpp:1: /usr/include/c++/10/bits/stl_tree.h:1301: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_find_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]' 1301 | _M_find_tr(const _Kt& __k) | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1301:2: note: template argument deduction/substitution failed: /usr/include/c++/10/bits/stl_tree.h:1310: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_find_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = std::pair<int, int>; _Val = std::pair<int, int>; _KeyOfValue = std::_Identity<std::pair<int, int> >; _Compare = std::less<std::pair<int, int> >; _Alloc = std::allocator<std::pair<int, int> >]' 1310 | _M_find_tr(const _Kt& __k) const | ^~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:1310:2: note: template argument deduction/substitution failed: In file included from /usr/include/c++/10/set:62, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:87, from hot.cpp:1: /usr/include/c++/10/bits/stl_multiset.h:791:2: error: no matching function for call to 'std::_Rb_tree_const_iterator<std::pair<int, int> >::_Rb_tree_const_iterator(<brace-enclosed initializer list>)' 791 | find(const _Kt& __x) const | ^~~~ In file included from /usr/include/c++/10/map:60, from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:81, from hot.cpp:1: /usr/include/c++/10/bits/stl_tree.h:350:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator(const iterator&) [with _Tp = std::pair<int, int>; std::_Rb_tree_const_iterator<_Tp>::iterator = std::_Rb_tree_const_iterator<std::pair<int, int> >::iterator]' 350 | _Rb_tree_const_iterator(const iterator& __it) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:350:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/10/bits/stl_tree.h:347:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator(std::_Rb_tree_const_iterator<_Tp>::_Base_ptr) [with _Tp = std::pair<int, int>; std::_Rb_tree_const_iterator<_Tp>::_Base_ptr = const std::_Rb_tree_node_base*]' 347 | _Rb_tree_const_iterator(_Base_ptr __x) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:347:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/10/bits/stl_tree.h:343:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator() [with _Tp = std::pair<int, int>]' 343 | _Rb_tree_const_iterator() _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:343:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/10/bits/stl_tree.h:328:12: note: candidate: 'constexpr std::_Rb_tree_const_iterator<std::pair<int, int> >::_Rb_tree_const_iterator(const std::_Rb_tree_const_iterator<std::pair<int, int> >&)' 328 | struct _Rb_tree_const_iterator | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/10/bits/stl_tree.h:328:12: note: conversion of argument 1 would be ill-formed: /usr/include/c++/10/bits/stl_tree.h:328:12: note: candidate: 'constexpr std::_Rb_tree_const_iterator<std::pair<int, int> >::_Rb_tree_const_iterator(std::_Rb_tree_const_iterator<std::pair<int, int> >&&)' /usr/include/c++/10/bits/stl_tree.h:328:12: note: conversion of argument 1 would be ill-formed: