問題を解くコードをサーバに投稿すると。
サーバ側では投稿されたコードをGCCでコンパイル。、
サーバ側で採点用データをきちんと処理できるか判断し、コードが採点用データをきちんと処理し問題をきちんと解いてるなら合格と返すサービスが提供されています。
一応私問題を解くコードを書き手元のBCCでコンパイルするのに成功したのですが、サーバに送信すると下記のようなコンパイルエラーがかえってきて不正解となりました。
std::bitsetをstd::mapに使おうとした部分がエラーとなってるようです。
なぜこのようなエラーが出るのかエラーを出さないようにするにはコードをどう修正すれば良いかアドバイスお願いします。
ちょっと行が移動していますがエラーログを読めば大体どの位置でどのような問題が起きているか分かると思います。
Run ID: 370518
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h: In instantiation of ‘std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:424: instantiated from ‘std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:133: instantiated from ‘std::map, std::bitset<102u>, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >’
code.cpp:43: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:399: error: field ‘std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl::_M_key_compare’ invalidly declared function type
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h: In instantiation of ‘std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:133: instantiated from ‘std::map, std::bitset<102u>, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >’
code.cpp:43: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:592: error: function returning a function
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h: In instantiation of ‘std::map, std::bitset<102u>, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >’:
code.cpp:43: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:590: error: function returning a function
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h: In member function ‘_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’:
code.cpp:74: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:418: error: ‘key_comp’ was not declared in this scope
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h: In member function ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::find(const _Key&) [with _Key = std::bitset<102u>, _Val = std::pair, std::bitset<102u> >, _KeyOfValue = std::_Select1st, std::bitset<102u> > >, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:615: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:89: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1395: error: 関数に対する引数が多すぎます
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1395: error: no match for ‘operator||’ in ‘__j.std::_Rb_tree_iterator<_Tp>::operator== [with _Tp = std::pair, std::bitset<102u> >]))) || ((std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >*)this)->std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_M_impl.std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl::_M_key_compare()’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1395: note: candidates are: operator||(bool, bool)
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h: In member function ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique_(std::_Rb_tree_const_iterator<_Val>, const _Val&) [with _Key = std::bitset<102u>, _Val = std::pair, std::bitset<102u> >, _KeyOfValue = std::_Select1st, std::bitset<102u> > >, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:496: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator, const std::pair&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:419: instantiated from ‘_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:74: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1183: error: 関数に対する引数が多すぎます
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:496: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator, const std::pair&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:419: instantiated from ‘_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:74: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1183: error: no match for ‘operator&&’ in ‘(std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::size [with _Key = std::bitset<102u>, _Val = std::pair, std::bitset<102u> >, _KeyOfValue = std::_Select1st, std::bitset<102u> > >, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]() != 0u) && ((std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >*)this)->std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_M_impl.std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl::_M_key_compare()’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1183: note: candidates are: operator&&(bool, bool)
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:496: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator, const std::pair&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:419: instantiated from ‘_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:74: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1190: error: 関数に対する引数が多すぎます
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1190: error: could not convert ‘((std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >*)this)->std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_M_impl.std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl::_M_key_compare()’ to ‘bool’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:496: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator, const std::pair&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:419: instantiated from ‘_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:74: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1197: error: 関数に対する引数が多すぎます
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1197: error: could not convert ‘((std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >*)this)->std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_M_impl.std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl::_M_key_compare()’ to ‘bool’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:496: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator, const std::pair&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:419: instantiated from ‘_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:74: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1209: error: 関数に対する引数が多すぎます
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1209: error: could not convert ‘((std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >*)this)->std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_M_impl.std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl::_M_key_compare()’ to ‘bool’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:496: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator, const std::pair&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:419: instantiated from ‘_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:74: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1216: error: 関数に対する引数が多すぎます
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1216: error: could not convert ‘((std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >*)this)->std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_M_impl.std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl::_M_key_compare()’ to ‘bool’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h: In member function ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_lower_bound(std::_Rb_tree_node<_Val>*, std::_Rb_tree_node<_Val>*, const _Key&) [with _Key = std::bitset<102u>, _Val = std::pair, std::bitset<102u> >, _KeyOfValue = std::_Select1st, std::bitset<102u> > >, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1392: instantiated from ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::find(const _Key&) [with _Key = std::bitset<102u>, _Val = std::pair, std::bitset<102u> >, _KeyOfValue = std::_Select1st, std::bitset<102u> > >, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:615: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::find(const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:89: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:957: error: 関数に対する引数が多すぎます
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:957: error: no match for ‘operator!’ in ‘!((std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >*)this)->std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_M_impl.std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl::_M_key_compare()’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:957: note: candidates are: operator!(bool)
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h: In member function ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_(const std::_Rb_tree_node_base*, const std::_Rb_tree_node_base*, const _Val&) [with _Key = std::bitset<102u>, _Val = std::pair, std::bitset<102u> >, _KeyOfValue = std::_Select1st, std::bitset<102u> > >, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1186: instantiated from ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique_(std::_Rb_tree_const_iterator<_Val>, const _Val&) [with _Key = std::bitset<102u>, _Val = std::pair, std::bitset<102u> >, _KeyOfValue = std::_Select1st, std::bitset<102u> > >, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:496: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator, const std::pair&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:419: instantiated from ‘_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:74: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:850: error: 関数に対する引数が多すぎます
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:850: error: no match for ‘operator||’ in ‘ == __p)) || ((std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >*)this)->std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_M_impl.std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl::_M_key_compare()’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:850: note: candidates are: operator||(bool, bool)
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h: In member function ‘std::pair::iterator, bool> std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique(const _Val&) [with _Key = std::bitset<102u>, _Val = std::pair, std::bitset<102u> >, _KeyOfValue = std::_Select1st, std::bitset<102u> > >, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’:
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1188: instantiated from ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique_(std::_Rb_tree_const_iterator<_Val>, const _Val&) [with _Key = std::bitset<102u>, _Val = std::pair, std::bitset<102u> >, _KeyOfValue = std::_Select1st, std::bitset<102u> > >, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:496: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator, const std::pair&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:419: instantiated from ‘_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:74: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1141: error: 関数に対する引数が多すぎます
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1141: error: cannot convert ‘bitSetSorter’ to ‘bool’ in assignment
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1188: instantiated from ‘typename std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::iterator std::_Rb_tree<_Key, _Val, _KeyOfValue, _Compare, _Alloc>::_M_insert_unique_(std::_Rb_tree_const_iterator<_Val>, const _Val&) [with _Key = std::bitset<102u>, _Val = std::pair, std::bitset<102u> >, _KeyOfValue = std::_Select1st, std::bitset<102u> > >, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:496: instantiated from ‘typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator std::map<_Key, _Tp, _Compare, _Alloc>::insert(typename std::_Rb_tree<_Key, std::pair, std::_Select1st >, _Compare, typename _Alloc::rebind >::other>::iterator, const std::pair&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_map.h:419: instantiated from ‘_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = std::bitset<102u>, _Tp = std::bitset<102u>, _Compare = bitSetSorter ()(), _Alloc = std::allocator, std::bitset<102u> > >]’
code.cpp:74: instantiated from here
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1152: error: 関数に対する引数が多すぎます
/usr/lib/gcc/i386-redhat-linux/4.3.0/../../../../include/c++/4.3.0/bits/stl_tree.h:1152: error: could not convert ‘((std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >*)this)->std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_M_impl.std::_Rb_tree, std::pair, std::bitset<102u> >, std::_Select1st, std::bitset<102u> > >, bitSetSorter ()(), std::allocator, std::bitset<102u> > > >::_Rb_tree_impl::_M_key_compare()’ to ‘bool’
以下送信したコード。
#include<stdio.h>
#include <bitset>
#include <map>
std::bitset<102> mask;
class bitSetSorter {
public:
bool operator()( const std::bitset<102> &L, const std::bitset<102> &R ) const
{
return hikaku(L,R);
}
bool hikaku( const std::bitset<102> &L, const std::bitset<102> &R )const{
//うーん何かナンセンスマシーンを作ってるような感じ,もっと短いコードないものか?
//もっと賢い方法があるような気がしてならない、私ひとり間抜けなコードを書いているのではないかと、、、
if((L>>96).to_ulong() < (R>>96).to_ulong())return false;
else if((L>>96).to_ulong() > (R>>96).to_ulong())return true;
if(((L>>64)&mask).to_ulong() < ((R>>64)&mask).to_ulong())return false;
else if(((L>>64)&mask).to_ulong() > ((R>>64)&mask).to_ulong())return true;
if(((L>>32)&mask).to_ulong() < ((R>>32)&mask).to_ulong())return false;
else if(((L>>32)&mask).to_ulong() > ((R>>32)&mask).to_ulong())return true;
if((L&mask).to_ulong() < (R&mask).to_ulong())return false;
else if((L&mask).to_ulong() > (R&mask).to_ulong())return true;
return false;
}
};
void putAns(const std::bitset<102>& ans,int n){
int c=0;
for(int i=n-1;i>=0;i--){
if(ans.test(i)==1){
printf("%s%d",c==0?"":" ",n-i);
c=1;
}
}
printf("\n");
}
int main(){
int n,xs[102];
std::bitset<102> cons[102],nowSet,nowOut,temp,ans;
std::map<std::bitset<102>,std::bitset<102> ,bitSetSorter()> memo,next;
std::map<std::bitset<102>,std::bitset<102> ,bitSetSorter()>::iterator it;
nowSet.reset();
nowOut.reset();
ans.reset();
mask.reset();
for(int i=0;i<32;i++)mask.set(i);
scanf("%d",&n);
//ビット演算の高速化のために逆順で記録する
for(int i=n-1;i>=0;i--){
scanf("%d",&xs[i]);
cons[i].reset();
for(int j=n-1;j>i;j--){
//cons[i].set(i);
if(xs[j]%xs[i]==0||xs[i]%xs[j]==0){
cons[i].set(j);
cons[j].set(i);
}
}
}
bool skips[102];
for(int i=0;i<n;i++){
if(cons[i].any()==false){
skips[i]=true;
nowSet.set(i);//他と約数を持たないので飛ばす
}else{
skips[i]=false;
}
}
memo[nowOut]=nowSet;
bitSetSorter br;
for(int i=0;i<n;i++){ ;
if(skips[i]==true)continue;
next.clear();
next.insert(memo.begin(),memo.end());
for(it=memo.begin();it!=memo.end();it++){
nowOut=(*it).first;
nowSet=(*it).second;
if((cons[i]|nowOut).test(i)==0&&(cons[i]&nowSet).any()==false){
nowOut|=cons[i];
nowSet.set(i);
}
if(next.find(nowOut)==next.end()){
next[nowOut]=nowSet;
}else{
temp=next[nowOut];
if(temp.count()<nowSet.count()){
next[nowOut]=nowSet;
}
}
if(ans.count()<nowSet.count()){
ans=nowSet;
}else if(ans.count()==nowSet.count() && br.hikaku(ans,nowSet)==false){
ans=nowSet;
}
//printf("\n");
}
memo.clear();
memo.insert(next.begin(),next.end());
next.clear();
}
//printf("ans=");
putAns(ans,n);
}
最終更新:2012年04月03日 10:54