# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
134057 | junodeveloper | Detecting Molecules (IOI16_molecules) | C++14 | 컴파일 에러 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "molecules.h"
#include<bits/stdc++.h>
using namespace std;
std::vector<int> find_subset(int l, int u, std::vector<int> w) {
int i;
set<pair<long long,int> > st;
long long sum=0;
st.insert({0,0});
for(i=0;i<w.size();i++) {
sum+=w[i];
auto it=st.lower_bound(sum-u);
if(it!=st.end()) {
if(it->first<=sum-l) {
vector<int> ans;
for(int j=it->second+1;j<=i;j++) ans.push_back(w[j]);
return ans;
}
}
st.insert({sum,i});
}
return vector<int>(0);
}
컴파일 시 표준 에러 (stderr) 메시지
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)': molecules.cpp:9:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] for(i=0;i<w.size();i++) { ~^~~~~~~~~ molecules.cpp:11:31: error: no matching function for call to 'std::set<std::pair<long long int, int> >::lower_bound(long long int)' auto it=st.lower_bound(sum-u); ^ In file included from /usr/include/c++/7/set:61:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87, from molecules.cpp:2: /usr/include/c++/7/bits/stl_set.h:800:7: note: candidate: std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::lower_bound(const key_type&) [with _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >; std::set<_Key, _Compare, _Alloc>::iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::set<_Key, _Compare, _Alloc>::key_type = std::pair<long long int, int>] lower_bound(const key_type& __x) ^~~~~~~~~~~ /usr/include/c++/7/bits/stl_set.h:800:7: note: no known conversion for argument 1 from 'long long int' to 'const key_type& {aka const std::pair<long long int, int>&}' /usr/include/c++/7/bits/stl_set.h:804:7: note: candidate: std::set<_Key, _Compare, _Alloc>::const_iterator std::set<_Key, _Compare, _Alloc>::lower_bound(const key_type&) const [with _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >; std::set<_Key, _Compare, _Alloc>::const_iterator = std::_Rb_tree_const_iterator<std::pair<long long int, int> >; std::set<_Key, _Compare, _Alloc>::key_type = std::pair<long long int, int>] lower_bound(const key_type& __x) const ^~~~~~~~~~~ /usr/include/c++/7/bits/stl_set.h:804:7: note: no known conversion for argument 1 from 'long long int' to 'const key_type& {aka const std::pair<long long int, int>&}' /usr/include/c++/7/bits/stl_set.h:810: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_lower_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::lower_bound(const _Kt&) [with _Kt = _Kt; _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >] lower_bound(const _Kt& __x) ^~~~~~~~~~~ /usr/include/c++/7/bits/stl_set.h:810:2: note: template argument deduction/substitution failed: /usr/include/c++/7/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<std::pair<long long int, int> >::iterator)(((std::set<std::pair<long long int, int> >*)this)->std::set<std::pair<long long int, int> >::_M_t.std::_Rb_tree<std::pair<long long int, int>, std::pair<long long int, int>, std::_Identity<std::pair<long long int, int> >, std::less<std::pair<long long int, int> >, std::allocator<std::pair<long long int, int> > >::_M_lower_bound_tr(__x))) std::set<std::pair<long long int, int> >::lower_bound<_Kt>(const _Kt&) [with _Kt = long long int]': molecules.cpp:11:31: required from here /usr/include/c++/7/bits/stl_set.h:811:14: error: no matching function for call to 'std::_Rb_tree<std::pair<long long int, int>, std::pair<long long int, int>, std::_Identity<std::pair<long long int, int> >, std::less<std::pair<long long int, int> >, std::allocator<std::pair<long long int, int> > >::_M_lower_bound_tr(const long long int&)' -> decltype(iterator(_M_t._M_lower_bound_tr(__x))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/7/map:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:81, from molecules.cpp:2: /usr/include/c++/7/bits/stl_tree.h:1244: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_lower_bound_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = std::pair<long long int, int>; _Val = std::pair<long long int, int>; _KeyOfValue = std::_Identity<std::pair<long long int, int> >; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >] _M_lower_bound_tr(const _Kt& __k) ^~~~~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_tree.h:1244:2: note: template argument deduction/substitution failed: /usr/include/c++/7/bits/stl_tree.h:1241:9: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::pair<long long int, int> >, long long int, void>' typename _Req = ^~~~~~~~ /usr/include/c++/7/bits/stl_tree.h:1254: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_lower_bound_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = std::pair<long long int, int>; _Val = std::pair<long long int, int>; _KeyOfValue = std::_Identity<std::pair<long long int, int> >; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >] _M_lower_bound_tr(const _Kt& __k) const ^~~~~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_tree.h:1254:2: note: template argument deduction/substitution failed: /usr/include/c++/7/bits/stl_tree.h:1251:9: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::pair<long long int, int> >, long long int, void>' typename _Req = ^~~~~~~~ In file included from /usr/include/c++/7/set:61:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:87, from molecules.cpp:2: /usr/include/c++/7/bits/stl_set.h:816:2: note: candidate: template<class _Kt> decltype ((std::set<_Key, _Compare, _Alloc>::const_iterator)(((const std::set<_Key, _Compare, _Alloc>*)this)->std::set<_Key, _Compare, _Alloc>::_M_t._M_lower_bound_tr(__x))) std::set<_Key, _Compare, _Alloc>::lower_bound(const _Kt&) const [with _Kt = _Kt; _Key = std::pair<long long int, int>; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >] lower_bound(const _Kt& __x) const ^~~~~~~~~~~ /usr/include/c++/7/bits/stl_set.h:816:2: note: template argument deduction/substitution failed: /usr/include/c++/7/bits/stl_set.h: In substitution of 'template<class _Kt> decltype ((std::set<std::pair<long long int, int> >::const_iterator)(((const std::set<std::pair<long long int, int> >*)this)->std::set<std::pair<long long int, int> >::_M_t.std::_Rb_tree<std::pair<long long int, int>, std::pair<long long int, int>, std::_Identity<std::pair<long long int, int> >, std::less<std::pair<long long int, int> >, std::allocator<std::pair<long long int, int> > >::_M_lower_bound_tr(__x))) std::set<std::pair<long long int, int> >::lower_bound<_Kt>(const _Kt&) const [with _Kt = long long int]': molecules.cpp:11:31: required from here /usr/include/c++/7/bits/stl_set.h:817:14: error: no matching function for call to 'std::_Rb_tree<std::pair<long long int, int>, std::pair<long long int, int>, std::_Identity<std::pair<long long int, int> >, std::less<std::pair<long long int, int> >, std::allocator<std::pair<long long int, int> > >::_M_lower_bound_tr(const long long int&) const' -> decltype(const_iterator(_M_t._M_lower_bound_tr(__x))) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/7/map:60:0, from /usr/include/x86_64-linux-gnu/c++/7/bits/stdc++.h:81, from molecules.cpp:2: /usr/include/c++/7/bits/stl_tree.h:1244: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_lower_bound_tr(const _Kt&) [with _Kt = _Kt; _Req = _Req; _Key = std::pair<long long int, int>; _Val = std::pair<long long int, int>; _KeyOfValue = std::_Identity<std::pair<long long int, int> >; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >] _M_lower_bound_tr(const _Kt& __k) ^~~~~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_tree.h:1244:2: note: template argument deduction/substitution failed: /usr/include/c++/7/bits/stl_tree.h:1241:9: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::pair<long long int, int> >, long long int, void>' typename _Req = ^~~~~~~~ /usr/include/c++/7/bits/stl_tree.h:1254: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_lower_bound_tr(const _Kt&) const [with _Kt = _Kt; _Req = _Req; _Key = std::pair<long long int, int>; _Val = std::pair<long long int, int>; _KeyOfValue = std::_Identity<std::pair<long long int, int> >; _Compare = std::less<std::pair<long long int, int> >; _Alloc = std::allocator<std::pair<long long int, int> >] _M_lower_bound_tr(const _Kt& __k) const ^~~~~~~~~~~~~~~~~ /usr/include/c++/7/bits/stl_tree.h:1254:2: note: template argument deduction/substitution failed: /usr/include/c++/7/bits/stl_tree.h:1251:9: error: no type named 'type' in 'struct std::__has_is_transparent<std::less<std::pair<long long int, int> >, long long int, void>' typename _Req = ^~~~~~~~