QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#475101#6749. TargetGuanYunchangCompile Error//C++111.1kb2024-07-13 11:22:372024-07-13 11:22:38

Details

answer.code: In function ‘int main()’:
answer.code:28:5: error: ‘map’ was not declared in this scope
   28 |     map<double, int> m;
      |     ^~~
answer.code:7:1: note: ‘std::map’ is defined in header ‘<map>’; did you forget to ‘#include <map>’?
    6 | #include<unordered_map>
  +++ |+#include <map>
    7 | using namespace std;
answer.code:28:9: error: expected primary-expression before ‘double’
   28 |     map<double, int> m;
      |         ^~~~~~
answer.code:30:13: error: no matching function for call to ‘std::unordered_map<std::__cxx11::basic_string<char>, int>::insert(<brace-enclosed initializer list>)’
   30 |     m.insert({ x, 1 });
      |     ~~~~~~~~^~~~~~~~~~
In file included from /usr/include/c++/13/unordered_map:41,
                 from answer.code:6:
/usr/include/c++/13/bits/unordered_map.h:570:9: note: candidate: ‘template<class _Pair> std::__enable_if_t<std::is_constructible<typename std::_Hashtable<_Key, std::pair<const _Key, _Val>, _Alloc, std::__detail::_Select1st, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__is_nothrow_invocable<const _Hash&, const _Key&> > >::value, false, true> >::value_type, _Pair&&>::value, std::pair<typename std::_Hashtable<_Key, std::pair<const _Key, _Val>, _Alloc, std::__detail::_Select1st, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__is_nothrow_invocable<const _Hash&, const _Key&> > >::value, false, true> >::iterator, bool> > std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_Pair&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Hash = std::hash<std::__cxx11::basic_string<char> >; _Pred = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >]’
  570 |         insert(_Pair&& __x)
      |         ^~~~~~
/usr/include/c++/13/bits/unordered_map.h:570:9: note:   template argument deduction/substitution failed:
answer.code:30:13: note:   couldn’t deduce template parameter ‘_Pair’
   30 |     m.insert({ x, 1 });
      |     ~~~~~~~~^~~~~~~~~~
/usr/include/c++/13/bits/unordered_map.h:608:9: note: candidate: ‘template<class _Pair> std::__enable_if_t<std::is_constructible<typename std::_Hashtable<_Key, std::pair<const _Key, _Val>, _Alloc, std::__detail::_Select1st, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__is_nothrow_invocable<const _Hash&, const _Key&> > >::value, false, true> >::value_type, _Pair&&>::value, typename std::_Hashtable<_Key, std::pair<const _Key, _Val>, _Alloc, std::__detail::_Select1st, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<std::__not_<std::__and_<std::__is_fast_hash<_Hash>, std::__is_nothrow_invocable<const _Hash&, const _Key&> > >::value, false, true> >::iterator> std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(const_iterator, _Pair&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Hash = std::hash<std::__cxx11::basic_string<char> >; _Pred = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >]’
  608 |         insert(const_iterator __hint, _Pair&& __x)
      |         ^~~~~~
/usr/include/c++/13/bits/unordered_map.h:608:9: note:   template argument deduction/substitution failed:
answer.code:30:13: note:   candidate expects 2 arguments, 1 provided
   30 |     m.insert({ x, 1 });
      |     ~~~~~~~~^~~~~~~~~~
/usr/include/c++/13/bits/unordered_map.h:623:9: note: candidate: ‘template<class _InputIterator> void std::unordered_map<_Key, _Tp, _Hash, _Pred, _Alloc>::insert(_InputIterator, _InputIterator) [with _Key = std::__cxx11::basic_string<char>; _Tp = int; _Hash = std::hash<std::__cxx11::basic_string<char> >; _Pred = std::equal_to<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, int> >]’
  623 |         insert(_InputIterator __first, _InputIterator __last)
      |         ^~~~~~
/usr/include/c++/13/bits/unordered_map.h:623:9: note:   template argument deduction/substitution failed:
answer.code:30:13: note:   candidate expects 2 arguments, 1 provided
   30 |     m.insert({ x, 1 });
      |     ~~~~~~~~^~~~~~~~~~
/usr/include/c++/13/bits/unordered_map.h:558:7: note: candidate: ‘std::pair<typename std::_Hashtable<_Key, std::pair<const _Key, _Val>, _Alloc, std::__detail::_Select1st, _Pred, _Hash, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail...