记录详情

Compile Error

foo.cc: In function 'long long int find_max(std::vector<int>)':
foo.cc:17:23: error: no matching function for call to 'max(long long int&, int&)'
   17 |                 ma=max(ma,x);
      |                    ~~~^~~~~~
In file included from /nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/bits/char_traits.h:39,
                 from /nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/ios:40,
                 from /nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/ostream:38,
                 from /nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/iostream:39,
                 from foo.cc:1:
/nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/bits/stl_algobase.h:254:5: note: candidate: 'template<class _Tp> const _Tp& std::max(const _Tp&, const _Tp&)'
  254 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/bits/stl_algobase.h:254:5: note:   template argument deduction/substitution failed:
foo.cc:17:23: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   17 |                 ma=max(ma,x);
      |                    ~~~^~~~~~
In file included from /nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/bits/char_traits.h:39,
                 from /nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/ios:40,
                 from /nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/ostream:38,
                 from /nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/iostream:39,
                 from foo.cc:1:
/nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/bits/stl_algobase.h:300:5: note: candidate: 'template<class _Tp, class _Compare> const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  300 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/nix/store/wy4ywjsch9q2hj5lphqjdg9p2kf7w0ls-gcc-11.3.0/include/c++/11.3.0/bits/stl_algobase.h:300:5: note:   template argument deduction/substitution failed:
foo.cc:17:23: note:   deduced conflicting types for parameter 'const _Tp' ('long long int' and 'int')
   17 |                 ma=max(ma,x);
      |                    ~~~^~~~~~
foo.cc: In function 'int main()':
foo.cc:52:41: error: expected primary-expression before 'ans'
   52 |         ll answer =find_max(vector<int> ans);
      |                                         ^~~
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
自测
题目
P1434 3-2 可莉的炸弹研究实验
语言
C++
递交时间
2023-07-06 15:01:35
评测时间
2023-07-06 15:01:35
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes