QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#45552#4565. Rarest InsectsZhangYiDeCompile Error//C++17849b2022-08-24 12:40:592022-08-24 12:41:01

Details

answer.code: In function ‘int press_button()’:
answer.code:23:35: error: ‘T’ was not declared in this scope
   23 |                         if(m.find(T[i]) != m.end()) m[T[i]]++;
      |                                   ^
answer.code:24:38: error: no matching function for call to ‘std::map<int, int>::insert(<brace-enclosed initializer list>)’
   24 |                         else m.insert({T[i], 1});
      |                              ~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:81,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_map.h:816:9: note: candidate: ‘template<class _Pair> std::__enable_if_t<std::is_constructible<std::pair<const _Key, _Tp>, _Pair>::value, std::pair<typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other>::iterator, bool> > std::map<_Key, _Tp, _Compare, _Alloc>::insert(_Pair&&) [with _Pair = _Pair; _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]’
  816 |         insert(_Pair&& __x)
      |         ^~~~~~
/usr/include/c++/11/bits/stl_map.h:816:9: note:   template argument deduction/substitution failed:
answer.code:24:38: note:   couldn’t deduce template parameter ‘_Pair’
   24 |                         else m.insert({T[i], 1});
      |                              ~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:81,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_map.h:875:9: note: candidate: ‘template<class _Pair> std::__enable_if_t<std::is_constructible<std::pair<const _Key, _Tp>, _Pair>::value, typename std::_Rb_tree<_Key, std::pair<const _Key, _Tp>, std::_Select1st<std::pair<const _Key, _Tp> >, _Compare, typename __gnu_cxx::__alloc_traits<_Allocator>::rebind<std::pair<const _Key, _Tp> >::other>::iterator> std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::const_iterator, _Pair&&) [with _Pair = _Pair; _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]’
  875 |         insert(const_iterator __position, _Pair&& __x)
      |         ^~~~~~
/usr/include/c++/11/bits/stl_map.h:875:9: note:   template argument deduction/substitution failed:
answer.code:24:38: note:   candidate expects 2 arguments, 1 provided
   24 |                         else m.insert({T[i], 1});
      |                              ~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:81,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_map.h:893:9: note: candidate: ‘template<class _InputIterator> void std::map<_Key, _Tp, _Compare, _Alloc>::insert(_InputIterator, _InputIterator) [with _InputIterator = _InputIterator; _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >]’
  893 |         insert(_InputIterator __first, _InputIterator __last)
      |         ^~~~~~
/usr/include/c++/11/bits/stl_map.h:893:9: note:   template argument deduction/substitution failed:
answer.code:24:38: note:   candidate expects 2 arguments, 1 provided
   24 |                         else m.insert({T[i], 1});
      |                              ~~~~~~~~^~~~~~~~~~~
In file included from /usr/include/c++/11/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:81,
                 from answer.code:1:
/usr/include/c++/11/bits/stl_map.h:629:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>::insert_return_type std::map<_Key, _Tp, _Compare, _Alloc>::insert(std::map<_Key, _Tp, _Compare, _Alloc>::node_type&&) [with _Key = int; _Tp = int; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, int> >; std::map<_Key, _Tp, _Compare, _Alloc>::insert_return_type = std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::insert_return_type; std::map<_Key, _Tp, _Compare, _Alloc>::node_type = std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::node_type]’
  629 |       insert(node_type&& __nh)
      |       ^~~~~~
/usr/include/c++/11/bits/stl_map.h:629:26: note:   no known conversion for argument 1 from ‘<brace-enclosed initializer list>’ to ‘std::map<int, int>::node_type&&’ {aka ‘std::_Rb_tree<int, std::pair<const int, int>, std::_Select1st<std::pair<const int, int> >, std::less<int>, std::allocator<std::pair<const int, int> > >::node_type&&’}
  629 |       insert(node_type&& __nh)
      |              ~~~~~~~~~~~~^~~~
/usr/include/c++/11/bits/stl_map....