/ Vijos /

记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:58:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if (n > availableDishes.size() || n <= 0) {
                 ~~^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/c++/6/unordered_map:41:0,
                 from /in/foo.cc:4:
/usr/include/c++/6/tuple: In instantiation of 'std::pair<_T1, _T2>::pair(std::tuple<_Args1 ...>&, std::tuple<_Args2 ...>&, std::_Index_tuple<_Indexes1 ...>, std::_Index_tuple<_Indexes2 ...>) [with _Args1 = {const int&}; long unsigned int ..._Indexes1 = {0ul}; _Args2 = {}; long unsigned int ..._Indexes2 = {}; _T1 = const int; _T2 = Dish]':
/usr/include/c++/6/tuple:1579:63:   required from 'std::pair<_T1, _T2>::pair(std::piecewise_construct_t, std::tuple<_Args1 ...>, std::tuple<_Args2 ...>) [with _Args1 = {const int&}; _Args2 = {}; _T1 = const int; _T2 = Dish]'
/usr/include/c++/6/ext/new_allocator.h:120:4:   required from 'void __gnu_cxx::new_allocator<_Tp>::construct(_Up*, _Args&& ...) [with _Up = std::pair<const int, Dish>; _Args = {const std::piecewise_construct_t&, std::tuple<const int&>, std::tuple<>}; _Tp = std::pair<const int, Dish>]'
/usr/include/c++/6/bits/alloc_traits.h:475:4:   required from 'static void std::allocator_traits<std::allocator<_CharT> >::construct(std::allocator_traits<std::allocator<_CharT> >::allocator_type&, _Up*, _Args&& ...) [with _Up = std::pair<const int, Dish>; _Args = {const std::piecewise_construct_t&, std::tuple<const int&>, std::tuple<>}; _Tp = std::pair<const int, Dish>; std::allocator_traits<std::allocator<_CharT> >::allocator_type = std::allocator<std::pair<const int, Dish> >]'
/usr/include/c++/6/bits/hashtable_policy.h:1953:37:   required from 'std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type* std::__detail::_Hashtable_alloc<_NodeAlloc>::_M_allocate_node(_Args&& ...) [with _Args = {const std::piecewise_construct_t&, std::tuple<const int&>, std::tuple<>}; _NodeAlloc = std::allocator<std::__detail::_Hash_node<std::pair<const int, Dish>, false> >; std::__detail::_Hashtable_alloc<_NodeAlloc>::__node_type = std::__detail::_Hash_node<std::pair<const int, Dish>, false>]'
/usr/include/c++/6/bits/hashtable_policy.h:595:8:   required from 'std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::mapped_type& std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::operator[](const key_type&) [with _Key = int; _Pair = std::pair<const int, Dish>; _Alloc = std::allocator<std::pair<const int, Dish> >; _Equal = std::equal_to<int>; _H1 = std::hash<int>; _H2 = std::__detail::_Mod_range_hashing; _Hash = std::__detail::_Default_ranged_hash; _RehashPolicy = std::__detail::_Prime_rehash_policy; _Traits = std::__detail::_Hashtable_traits<false, false, true>; std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::mapped_type = Dish; std::__detail::_Map_base<_Key, _Pair, _Alloc, std::__detail::_Select1st, _Equal, _H1, _H2, _Hash, _RehashPolicy, _Traits, true>::key_type = int]'
/usr/include/c++/6/bits/unordered_map.h:904:20:   required from 'std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type& std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::operator[](const key_type&) [with _Key = int; _Tp = Dish; _Hash = std::hash<int>; _Pred = std::equal_to<int>; _Alloc = std::allocator<std::pair<const int, Dish> >; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::mapped_type = Dish; std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::key_type = int]'
/in/foo.cc:41:26:   required from here
/usr/include/c++/6/tuple:1590:70: error: no matching function for call to 'Dish::Dish()'
         second(std::forward<_Args2>(std::get<_Indexes2>(__tuple2))...)
                                                                      ^
/in/foo.cc:14:5: note: candidate: Dish::Dish(int, int)
     Dish(int p, int i) : price(p), id(i) {}
     ^~~~
/in/foo.cc:14:5: note:   candidate expects 2 arguments, 0 provided
/in/foo.cc:9:8: note: candidate: constexpr Dish::Dish(const Dish&)
 struct Dish {
        ^~~~
/in/foo.cc:9:8: note:   candidate expects 1 argument, 0 provided
/in/foo.cc:9:8: note: candidate: constexpr Dish::Dish(Dish&&)
/in/foo.cc:9:8: note:   candidate expects 1 argument, 0 provided

信息

递交者
类型
递交
题目
P1647 不差钱
语言
C++
递交时间
2024-09-13 12:59:20
评测时间
2024-09-13 12:59:20
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes