Compile Error

foo.cc:3:9: error: 'N' was not declared in this scope
    3 | int n,a[N],min=N,ans=0;
      |         ^
foo.cc:3:16: error: 'N' was not declared in this scope
    3 | int n,a[N],min=N,ans=0;
      |                ^
foo.cc: In function 'int main()':
foo.cc:10:14: error: 'a' was not declared in this scope
   10 |         cin>>a[i];
      |              ^
foo.cc:11:12: error: reference to 'min' is ambiguous
   11 |         if(min > a[i])
      |            ^~~
In file included from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/algorithm:62,
                 from stdc++.h:65:
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algo.h:3455:5: note: candidates are: 'template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algo.h:3449:5: note:                 'template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
In file included from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/char_traits.h:39,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/ios:40,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/istream:38,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/sstream:38,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/complex:45,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/ccomplex:39,
                 from stdc++.h:54:
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algobase.h:278:5: note:                 'template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algobase.h:230:5: note:                 'template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
foo.cc:3:12: note:                 'int min'
    3 | int n,a[N],min=N,ans=0;
      |            ^~~
foo.cc:12:13: error: reference to 'min' is ambiguous
   12 |             min=a[i];
      |             ^~~
In file included from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/algorithm:62,
                 from stdc++.h:65:
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algo.h:3455:5: note: candidates are: 'template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algo.h:3449:5: note:                 'template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
In file included from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/char_traits.h:39,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/ios:40,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/istream:38,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/sstream:38,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/complex:45,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/ccomplex:39,
                 from stdc++.h:54:
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algobase.h:278:5: note:                 'template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algobase.h:230:5: note:                 'template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
foo.cc:3:12: note:                 'int min'
    3 | int n,a[N],min=N,ans=0;
      |            ^~~
foo.cc:13:9: error: 'ans' was not declared in this scope; did you mean 'abs'?
   13 |         ans=max(ans,a[i]-min);
      |         ^~~
      |         abs
foo.cc:13:26: error: reference to 'min' is ambiguous
   13 |         ans=max(ans,a[i]-min);
      |                          ^~~
In file included from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/algorithm:62,
                 from stdc++.h:65:
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algo.h:3455:5: note: candidates are: 'template<class _Tp, class _Compare> _Tp std::min(std::initializer_list<_Tp>, _Compare)'
 3455 |     min(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algo.h:3449:5: note:                 'template<class _Tp> _Tp std::min(std::initializer_list<_Tp>)'
 3449 |     min(initializer_list<_Tp> __l)
      |     ^~~
In file included from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/char_traits.h:39,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/ios:40,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/istream:38,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/sstream:38,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/complex:45,
                 from /nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/ccomplex:39,
                 from stdc++.h:54:
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algobase.h:278:5: note:                 'template<class _Tp, class _Compare> const _Tp& std::min(const _Tp&, const _Tp&, _Compare)'
  278 |     min(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/nix/store/42izybv2fz3ps5pcg3dvcmn85pc9406y-gcc-11.3.0/include/c++/11.3.0/bits/stl_algobase.h:230:5: note:                 'template<class _Tp> const _Tp& std::min(const _Tp&, const _Tp&)'
  230 |     min(const _Tp& __a, const _Tp& __b)
      |     ^~~
foo.cc:3:12: note:                 'int min'
    3 | int n,a[N],min=N,ans=0;
      |            ^~~
foo.cc:15:11: error: 'ans' was not declared in this scope; did you mean 'abs'?
   15 |     cout<<ans;
      |           ^~~
      |           abs
[Hydro](https://hydro.ac)提供评测服务

信息

递交者
类型
递交
题目
P1324 3-3 炒股发财
语言
C++
递交时间
2022-08-20 21:50:15
评测时间
2022-08-20 21:50:15
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes