记录详情

Compile Error

foo.cc: In function 'int main()':
foo.cc:21:36: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type*' {aka 'int*'} [-Wformat=]
   21 |  for (i = 0; i < n; i++) scanf("%lld", &v[i]);
      |                                 ~~~^
      |                                    |
      |                                    long long int*
      |                                 %d
foo.cc:46:8: error: no match for 'operator[]' (operand types are 'std::map<std::map<long long int, long long int>, long long int>' and 'll' {aka 'long long int'})
   46 |   if(dp[l][r])
      |        ^
In file included from /usr/include/c++/9/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:81,
                 from foo.cc:1:
/usr/include/c++/9/bits/stl_map.h:490:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::map<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::map<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::map<long long int, long long int>, long long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = long long int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::map<long long int, long long int>]'
  490 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/9/bits/stl_map.h:490:34: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'const key_type&' {aka 'const std::map<long long int, long long int>&'}
  490 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_map.h:510: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::map<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::map<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::map<long long int, long long int>, long long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = long long int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::map<long long int, long long int>]'
  510 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/9/bits/stl_map.h:510:29: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::map<std::map<long long int, long long int>, long long int>::key_type&&' {aka 'std::map<long long int, long long int>&&'}
  510 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
foo.cc:57:6: error: no match for 'operator[]' (operand types are 'std::map<std::map<long long int, long long int>, long long int>' and 'll' {aka 'long long int'})
   57 |    dp[l][r]=ans;
      |      ^
In file included from /usr/include/c++/9/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:81,
                 from foo.cc:1:
/usr/include/c++/9/bits/stl_map.h:490:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::map<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::map<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::map<long long int, long long int>, long long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = long long int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::map<long long int, long long int>]'
  490 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/9/bits/stl_map.h:490:34: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'const key_type&' {aka 'const std::map<long long int, long long int>&'}
  490 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_map.h:510: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::map<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::map<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::map<long long int, long long int>, long long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = long long int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::map<long long int, long long int>]'
  510 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/9/bits/stl_map.h:510:29: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::map<std::map<long long int, long long int>, long long int>::key_type&&' {aka 'std::map<long long int, long long int>&&'}
  510 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
foo.cc:65:6: error: no match for 'operator[]' (operand types are 'std::map<std::map<long long int, long long int>, long long int>' and 'll' {aka 'long long int'})
   65 |    dp[l][r]=ans;
      |      ^
In file included from /usr/include/c++/9/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:81,
                 from foo.cc:1:
/usr/include/c++/9/bits/stl_map.h:490:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::map<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::map<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::map<long long int, long long int>, long long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = long long int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::map<long long int, long long int>]'
  490 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/9/bits/stl_map.h:490:34: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'const key_type&' {aka 'const std::map<long long int, long long int>&'}
  490 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_map.h:510: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::map<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::map<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::map<long long int, long long int>, long long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = long long int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::map<long long int, long long int>]'
  510 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/9/bits/stl_map.h:510:29: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::map<std::map<long long int, long long int>, long long int>::key_type&&' {aka 'std::map<long long int, long long int>&&'}
  510 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
foo.cc:73:6: error: no match for 'operator[]' (operand types are 'std::map<std::map<long long int, long long int>, long long int>' and 'll' {aka 'long long int'})
   73 |    dp[l][r]=ans;
      |      ^
In file included from /usr/include/c++/9/map:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:81,
                 from foo.cc:1:
/usr/include/c++/9/bits/stl_map.h:490:7: note: candidate: 'std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const key_type&) [with _Key = std::map<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::map<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::map<long long int, long long int>, long long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = long long int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::map<long long int, long long int>]'
  490 |       operator[](const key_type& __k)
      |       ^~~~~~~~
/usr/include/c++/9/bits/stl_map.h:490:34: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'const key_type&' {aka 'const std::map<long long int, long long int>&'}
  490 |       operator[](const key_type& __k)
      |                  ~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_map.h:510: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::map<long long int, long long int>; _Tp = long long int; _Compare = std::less<std::map<long long int, long long int> >; _Alloc = std::allocator<std::pair<const std::map<long long int, long long int>, long long int> >; std::map<_Key, _Tp, _Compare, _Alloc>::mapped_type = long long int; std::map<_Key, _Tp, _Compare, _Alloc>::key_type = std::map<long long int, long long int>]'
  510 |       operator[](key_type&& __k)
      |       ^~~~~~~~
/usr/include/c++/9/bits/stl_map.h:510:29: note:   no known conversion for argument 1 from 'll' {aka 'long long int'} to 'std::map<std::map<long long int, long long int>, long long int>::key_type&&' {aka 'std::map<long long int, long long int>&&'}
  510 |       operator[](key_type&& __k)
      |                  ~~~~~~~~~~~^~~
foo.cc:79:37: warning: format '%lld' expects argument of type 'long long int', but argument 2 has type '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} [-Wformat=]
   79 |  for (i = 0; i < q; i++) printf("%lld\n", cnt[i]);
      |                                  ~~~^
      |                                     |
      |                                     long long int
      |                                  %d
foo.cc:21:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   21 |  for (i = 0; i < n; i++) scanf("%lld", &v[i]);
      |                          ~~~~~^~~~~~~~~~~~~~~
foo.cc:24:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   24 |   scanf("%lld%lld", &t[i].l, &t[i].r);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
自测
题目
P1316 Multiple of k
语言
C++
递交时间
2022-02-03 12:22:26
评测时间
2022-02-03 12:22:26
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes