# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
314850 | 2020-10-21T13:29:38 Z | blue | Job Scheduling (IOI19_job) | C++17 | 컴파일 오류 |
0 ms | 0 KB |
#include "job.h" #include <vector> #include <algorithm> #include <set> using namespace std; struct job { long long u; long long d; vector<long long> children; }; bool operator < (job A, job B) { return A.u*B.d > B.u*A.d; } long long scheduling_cost(vector<int> p, vector<int> u, vector<int> d) { long long res = 0; long long n = p.size(); job J[n]; vector<long long> v; for(int i = 0; i < n; i++) { J[i] = job{u[i], d[i], v}; if(i > 0) J[p[i]].children.push_back(i); } long long t = 0; multiset<job> S; S.insert(J[0]); job j; while(!S.empty()) { j = *S.begin(); S.erase(S.find(S.begin())); for(int k: j.children) S.insert(J[k]); t += j.d; res += t * j.u; } return res; }
Compilation message
job.cpp: In function 'long long int scheduling_cost(std::vector<int>, std::vector<int>, std::vector<int>)': job.cpp:42:33: error: no matching function for call to 'std::multiset<job>::find(std::multiset<job>::iterator)' 42 | S.erase(S.find(S.begin())); | ^ In file included from /usr/include/c++/9/set:62, from job.cpp:4: /usr/include/c++/9/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 = job; _Compare = std::less<job>; _Alloc = std::allocator<job>; std::multiset<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<job>; std::multiset<_Key, _Compare, _Alloc>::key_type = job]' 775 | find(const key_type& __x) | ^~~~ /usr/include/c++/9/bits/stl_multiset.h:775:28: note: no known conversion for argument 1 from 'std::multiset<job>::iterator' {aka 'std::_Rb_tree_const_iterator<job>'} to 'const key_type&' {aka 'const job&'} 775 | find(const key_type& __x) | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/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 = job; _Compare = std::less<job>; _Alloc = std::allocator<job>; std::multiset<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<job>; std::multiset<_Key, _Compare, _Alloc>::key_type = job]' 779 | find(const key_type& __x) const | ^~~~ /usr/include/c++/9/bits/stl_multiset.h:779:28: note: no known conversion for argument 1 from 'std::multiset<job>::iterator' {aka 'std::_Rb_tree_const_iterator<job>'} to 'const key_type&' {aka 'const job&'} 779 | find(const key_type& __x) const | ~~~~~~~~~~~~~~~~^~~ /usr/include/c++/9/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 = job; _Compare = std::less<job>; _Alloc = std::allocator<job>]' 785 | find(const _Kt& __x) | ^~~~ /usr/include/c++/9/bits/stl_multiset.h:785:2: note: template argument deduction/substitution failed: /usr/include/c++/9/bits/stl_multiset.h: In substitution of 'template<class _Kt> decltype (std::multiset<job>::iterator{((std::multiset<job>*)this)->std::multiset<job>::_M_t.std::_Rb_tree<job, job, std::_Identity<job>, std::less<job>, std::allocator<job> >::_M_find_tr(__x)}) std::multiset<job>::find<_Kt>(const _Kt&) [with _Kt = std::_Rb_tree_const_iterator<job>]': job.cpp:42:33: required from here /usr/include/c++/9/bits/stl_multiset.h:785:2: error: no matching function for call to 'std::_Rb_tree<job, job, std::_Identity<job>, std::less<job>, std::allocator<job> >::_M_find_tr(const std::_Rb_tree_const_iterator<job>&)' In file included from /usr/include/c++/9/set:60, from job.cpp:4: /usr/include/c++/9/bits/stl_tree.h:1306: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 = job; _Val = job; _KeyOfValue = std::_Identity<job>; _Compare = std::less<job>; _Alloc = std::allocator<job>]' 1306 | _M_find_tr(const _Kt& __k) | ^~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:1306:2: note: template argument deduction/substitution failed: /usr/include/c++/9/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<job>; _SfinaeType = std::_Rb_tree_const_iterator<job>]': /usr/include/c++/9/bits/stl_tree.h:1304:9: required by substitution of 'template<class _Kt> decltype (std::multiset<job>::iterator{((std::multiset<job>*)this)->std::multiset<job>::_M_t.std::_Rb_tree<job, job, std::_Identity<job>, std::less<job>, std::allocator<job> >::_M_find_tr(__x)}) std::multiset<job>::find<_Kt>(const _Kt&) [with _Kt = std::_Rb_tree_const_iterator<job>]' job.cpp:42:33: required from here /usr/include/c++/9/bits/stl_tree.h:425:11: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<job>, std::_Rb_tree_const_iterator<job>, void>' 425 | using __has_is_transparent_t | ^~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_multiset.h: In substitution of 'template<class _Kt> decltype (std::multiset<job>::iterator{((std::multiset<job>*)this)->std::multiset<job>::_M_t.std::_Rb_tree<job, job, std::_Identity<job>, std::less<job>, std::allocator<job> >::_M_find_tr(__x)}) std::multiset<job>::find<_Kt>(const _Kt&) [with _Kt = std::_Rb_tree_const_iterator<job>]': job.cpp:42:33: required from here /usr/include/c++/9/bits/stl_tree.h:1315: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 = job; _Val = job; _KeyOfValue = std::_Identity<job>; _Compare = std::less<job>; _Alloc = std::allocator<job>]' 1315 | _M_find_tr(const _Kt& __k) const | ^~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:1315:2: note: template argument deduction/substitution failed: In file included from /usr/include/c++/9/set:62, from job.cpp:4: /usr/include/c++/9/bits/stl_multiset.h:785:2: error: no matching function for call to 'std::_Rb_tree_const_iterator<job>::_Rb_tree_const_iterator(<brace-enclosed initializer list>)' 785 | find(const _Kt& __x) | ^~~~ In file included from /usr/include/c++/9/set:60, from job.cpp:4: /usr/include/c++/9/bits/stl_tree.h:348:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator(const iterator&) [with _Tp = job; std::_Rb_tree_const_iterator<_Tp>::iterator = std::_Rb_tree_iterator<job>]' 348 | _Rb_tree_const_iterator(const iterator& __it) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:348:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/9/bits/stl_tree.h:345:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator(std::_Rb_tree_const_iterator<_Tp>::_Base_ptr) [with _Tp = job; std::_Rb_tree_const_iterator<_Tp>::_Base_ptr = const std::_Rb_tree_node_base*]' 345 | _Rb_tree_const_iterator(_Base_ptr __x) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:345:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/9/bits/stl_tree.h:341:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator() [with _Tp = job]' 341 | _Rb_tree_const_iterator() _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:341:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/9/bits/stl_tree.h:326:12: note: candidate: 'constexpr std::_Rb_tree_const_iterator<job>::_Rb_tree_const_iterator(const std::_Rb_tree_const_iterator<job>&)' 326 | struct _Rb_tree_const_iterator | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:326:12: note: conversion of argument 1 would be ill-formed: /usr/include/c++/9/bits/stl_tree.h:326:12: note: candidate: 'constexpr std::_Rb_tree_const_iterator<job>::_Rb_tree_const_iterator(std::_Rb_tree_const_iterator<job>&&)' /usr/include/c++/9/bits/stl_tree.h:326:12: note: conversion of argument 1 would be ill-formed: In file included from /usr/include/c++/9/set:62, from job.cpp:4: /usr/include/c++/9/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 = job; _Compare = std::less<job>; _Alloc = std::allocator<job>]' 791 | find(const _Kt& __x) const | ^~~~ /usr/include/c++/9/bits/stl_multiset.h:791:2: note: template argument deduction/substitution failed: /usr/include/c++/9/bits/stl_multiset.h: In substitution of 'template<class _Kt> decltype (std::multiset<job>::const_iterator{((const std::multiset<job>*)this)->std::multiset<job>::_M_t.std::_Rb_tree<job, job, std::_Identity<job>, std::less<job>, std::allocator<job> >::_M_find_tr(__x)}) std::multiset<job>::find<_Kt>(const _Kt&) const [with _Kt = std::_Rb_tree_const_iterator<job>]': job.cpp:42:33: required from here /usr/include/c++/9/bits/stl_multiset.h:791:2: error: no matching function for call to 'std::_Rb_tree<job, job, std::_Identity<job>, std::less<job>, std::allocator<job> >::_M_find_tr(const std::_Rb_tree_const_iterator<job>&) const' In file included from /usr/include/c++/9/set:60, from job.cpp:4: /usr/include/c++/9/bits/stl_tree.h:1306: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 = job; _Val = job; _KeyOfValue = std::_Identity<job>; _Compare = std::less<job>; _Alloc = std::allocator<job>]' 1306 | _M_find_tr(const _Kt& __k) | ^~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:1306:2: note: template argument deduction/substitution failed: /usr/include/c++/9/bits/stl_tree.h:1315: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 = job; _Val = job; _KeyOfValue = std::_Identity<job>; _Compare = std::less<job>; _Alloc = std::allocator<job>]' 1315 | _M_find_tr(const _Kt& __k) const | ^~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:1315:2: note: template argument deduction/substitution failed: In file included from /usr/include/c++/9/set:62, from job.cpp:4: /usr/include/c++/9/bits/stl_multiset.h:791:2: error: no matching function for call to 'std::_Rb_tree_const_iterator<job>::_Rb_tree_const_iterator(<brace-enclosed initializer list>)' 791 | find(const _Kt& __x) const | ^~~~ In file included from /usr/include/c++/9/set:60, from job.cpp:4: /usr/include/c++/9/bits/stl_tree.h:348:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator(const iterator&) [with _Tp = job; std::_Rb_tree_const_iterator<_Tp>::iterator = std::_Rb_tree_iterator<job>]' 348 | _Rb_tree_const_iterator(const iterator& __it) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:348:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/9/bits/stl_tree.h:345:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator(std::_Rb_tree_const_iterator<_Tp>::_Base_ptr) [with _Tp = job; std::_Rb_tree_const_iterator<_Tp>::_Base_ptr = const std::_Rb_tree_node_base*]' 345 | _Rb_tree_const_iterator(_Base_ptr __x) _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:345:7: note: conversion of argument 1 would be ill-formed: /usr/include/c++/9/bits/stl_tree.h:341:7: note: candidate: 'std::_Rb_tree_const_iterator<_Tp>::_Rb_tree_const_iterator() [with _Tp = job]' 341 | _Rb_tree_const_iterator() _GLIBCXX_NOEXCEPT | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:341:7: note: candidate expects 0 arguments, 1 provided /usr/include/c++/9/bits/stl_tree.h:326:12: note: candidate: 'constexpr std::_Rb_tree_const_iterator<job>::_Rb_tree_const_iterator(const std::_Rb_tree_const_iterator<job>&)' 326 | struct _Rb_tree_const_iterator | ^~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/9/bits/stl_tree.h:326:12: note: conversion of argument 1 would be ill-formed: /usr/include/c++/9/bits/stl_tree.h:326:12: note: candidate: 'constexpr std::_Rb_tree_const_iterator<job>::_Rb_tree_const_iterator(std::_Rb_tree_const_iterator<job>&&)' /usr/include/c++/9/bits/stl_tree.h:326:12: note: conversion of argument 1 would be ill-formed: