记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:16:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(i=0;i<s.size();i++)
          ~^~~~~~~~~
/in/foo.cc:18:12: error: no match for 'operator[]' (operand types are 'std::map<std::__cxx11::basic_string<char>, long long int>' and '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}')
   ans=ans*m[s[i]]%mod;
            ^
In file included from /usr/include/c++/6/map:61:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:81,
                 from /in/foo.cc:1:
/usr/include/c++/6/bits/stl_map.h:474:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::__cxx11::basic_string<char>; _Tp = long long int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = long long int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::__cxx11::basic_string<char>]
       operator[](const key_type& __k)
       ^~~~~~~~
/usr/include/c++/6/bits/stl_map.h:474:7: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}' to 'const key_type& {aka const std::__cxx11::basic_string<char>&}'
/usr/include/c++/6/bits/stl_map.h:494:7: note: candidate: std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](std::map<_Key, _Tp, _Compare, _Alloc>::key_type&&) [with _Key = std::__cxx11::basic_string<char>; _Tp = long long int; _Compare = std::less<std::__cxx11::basic_string<char> >; _Alloc = std::allocator<std::pair<const std::__cxx11::basic_string<char>, long long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = long long int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::__cxx11::basic_string<char>]
       operator[](key_type&& __k)
       ^~~~~~~~
/usr/include/c++/6/bits/stl_map.h:494:7: note:   no known conversion for argument 1 from '__gnu_cxx::__alloc_traits<std::allocator<char> >::value_type {aka char}' to 'std::map<std::__cxx11::basic_string<char>, long long int>::key_type&& {aka std::__cxx11::basic_string<char>&&}'
/in/foo.cc:6:29: warning: unused variable 'j' [-Wunused-variable]
  ll mod=998244353,ans=1,n,i,j,k;
                             ^

信息

递交者
类型
自测
题目
P1311 G. Rotating-Calipers
语言
C++
递交时间
2021-12-23 20:31:20
评测时间
2021-12-23 20:31:42
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes