Compile Error

foo.cc: In function ‘int main()’:
foo.cc:17:16: error: no match for ‘operator!’ (operand type is ‘std::map<int, bool>’)
   17 |             if(!vis[b])
      |                ^~~~~~~
foo.cc:17:16: note: candidate: ‘operator!(bool)’ (built-in)
foo.cc:17:16: note:   no known conversion for argument 1 from ‘std::map<int, bool>’ to ‘bool’
foo.cc:18:24: error: no match for ‘operator=’ (operand types are ‘std::map<int, bool>’ and ‘int’)
   18 |                 vis[b]=1;
      |                        ^
In file included from /nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/map:63,
                 from stdc++.h:152:
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_map.h:331:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>& std::map<_Key, _Tp, _Compare, _Alloc>::operator=(const std::map<_Key, _Tp, _Compare, _Alloc>&) [with _Key = int; _Tp = bool; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, bool> >]’
  331 |       operator=(const map&) = default;
      |       ^~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_map.h:331:17: note:   no known conversion for argument 1 from ‘int’ to ‘const std::map<int, bool>&’
  331 |       operator=(const map&) = default;
      |                 ^~~~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_map.h:335:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>& std::map<_Key, _Tp, _Compare, _Alloc>::operator=(std::map<_Key, _Tp, _Compare, _Alloc>&&) [with _Key = int; _Tp = bool; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, bool> >]’
  335 |       operator=(map&&) = default;
      |       ^~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_map.h:335:17: note:   no known conversion for argument 1 from ‘int’ to ‘std::map<int, bool>&&’
  335 |       operator=(map&&) = default;
      |                 ^~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_map.h:349:7: note: candidate: ‘std::map<_Key, _Tp, _Compare, _Alloc>& std::map<_Key, _Tp, _Compare, _Alloc>::operator=(std::initializer_list<std::pair<const _Key, _Tp> >) [with _Key = int; _Tp = bool; _Compare = std::less<int>; _Alloc = std::allocator<std::pair<const int, bool> >]’
  349 |       operator=(initializer_list<value_type> __l)
      |       ^~~~~~~~
/nix/gcc-14.2.1.20250322/include/c++/14.2.1.20250322/bits/stl_map.h:349:46: note:   no known conversion for argument 1 from ‘int’ to ‘std::initializer_list<std::pair<const int, bool> >’
  349 |       operator=(initializer_list<value_type> __l)
      |                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
foo.cc:27:36: error: no match for ‘operator!’ (operand type is ‘std::map<int, bool>’)
   27 |                                 if(!vis[b-1]&&b-1>=0)q.push(b-1);
      |                                    ^~~~~~~~~
foo.cc:27:36: note: candidate: ‘operator!(bool)’ (built-in)
foo.cc:27:36: note:   no known conversion for argument 1 from ‘std::map<int, bool>’ to ‘bool’
foo.cc:31:20: error: no match for ‘operator!’ (operand type is ‘std::map<int, bool>’)
   31 |                 if(!vis[b+1])q.push(b+1);
      |                    ^~~~~~~~~
foo.cc:31:20: note: candidate: ‘operator!(bool)’ (built-in)
foo.cc:31:20: note:   no known conversion for argument 1 from ‘std::map<int, bool>’ to ‘bool’
foo.cc:32:20: error: no match for ‘operator!’ (operand type is ‘std::map<int, bool>’)
   32 |                 if(!vis[b-1])q.push(b-1);
      |                    ^~~~~~~~~
foo.cc:32:20: note: candidate: ‘operator!(bool)’ (built-in)
foo.cc:32:20: note:   no known conversion for argument 1 from ‘std::map<int, bool>’ to ‘bool’
foo.cc:33:20: error: no match for ‘operator!’ (operand type is ‘std::map<int, bool>’)
   33 |                 if(!vis[b*2])q.push(b*2);
      |                    ^~~~~~~~~
foo.cc:33:20: note: candidate: ‘operator!(bool)’ (built-in)
foo.cc:33:20: note:   no known conversion for argument 1 from ‘std::map<int, bool>’ to ‘bool’

信息

递交者
类型
递交
题目
P1018 抓牛(catchcow)
语言
C++
递交时间
2025-07-23 13:46:55
评测时间
2025-07-23 13:46:55
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes