/ Vijos /

记录详情

Compile Error

/in/foo.cc: In function 'int main()':
/in/foo.cc:15:41: error: no matching function for call to 'abs(__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type, __gnu_cxx::__alloc_traits<std::allocator<int> >::value_type)'
    an += min(abs(v[i]-v[i-1],v[i]-v[i+1]));
                                         ^
In file included from /usr/include/c++/6/cstdlib:75:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:47,
                 from /in/foo.cc:2:
/usr/include/stdlib.h:735:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^~~
/usr/include/stdlib.h:735:12: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/6/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95,
                 from /in/foo.cc:2:
/usr/include/c++/6/bits/valarray_after.h:442:5: note: candidate: template<class _Tp> std::_Expr<std::_UnClos<std::_Abs, std::_ValArray, _Tp>, _Tp> std::abs(const std::valarray<_Tp>&)
     _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs)
     ^
/usr/include/c++/6/bits/valarray_after.h:442:5: note:   template argument deduction/substitution failed:
/in/foo.cc:15:41: note:   mismatched types 'const std::valarray<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
    an += min(abs(v[i]-v[i-1],v[i]-v[i+1]));
                                         ^
In file included from /usr/include/c++/6/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95,
                 from /in/foo.cc:2:
/usr/include/c++/6/bits/valarray_after.h:442:5: note: candidate: template<class _Dom> std::_Expr<std::_UnClos<std::_Abs, std::_Expr, _Dom>, typename _Dom::value_type> std::abs(const std::_Expr<_Dom1, typename _Dom1::value_type>&)
     _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs)
     ^
/usr/include/c++/6/bits/valarray_after.h:442:5: note:   template argument deduction/substitution failed:
/in/foo.cc:15:41: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
    an += min(abs(v[i]-v[i-1],v[i]-v[i+1]));
                                         ^
In file included from /usr/include/c++/6/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:52,
                 from /in/foo.cc:2:
/usr/include/c++/6/complex:597:5: note: candidate: template<class _Tp> _Tp std::abs(const std::complex<_Tp>&)
     abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
     ^~~
/usr/include/c++/6/complex:597:5: note:   template argument deduction/substitution failed:
/in/foo.cc:15:41: note:   mismatched types 'const std::complex<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
    an += min(abs(v[i]-v[i-1],v[i]-v[i+1]));
                                         ^
In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:47:0,
                 from /in/foo.cc:2:
/usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^~~
/usr/include/c++/6/cstdlib:180:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^~~
/usr/include/c++/6/cstdlib:172:3: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:41:0,
                 from /in/foo.cc:2:
/usr/include/c++/6/cmath:103:5: note: candidate: template<class _Tp> constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::abs(_Tp)
     abs(_Tp __x)
     ^~~
/usr/include/c++/6/cmath:103:5: note:   template argument deduction/substitution failed:
/in/foo.cc:15:41: note:   candidate expects 1 argument, 2 provided
    an += min(abs(v[i]-v[i-1],v[i]-v[i+1]));
                                         ^
In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:41:0,
                 from /in/foo.cc:2:
/usr/include/c++/6/cmath:95:3: note: candidate: constexpr long double std::abs(long double)
   abs(long double __x)
   ^~~
/usr/include/c++/6/cmath:95:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/6/cmath:91:3: note: candidate: constexpr float std::abs(float)
   abs(float __x)
   ^~~
/usr/include/c++/6/cmath:91:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/6/cmath:85:3: note: candidate: constexpr double std::abs(double)
   abs(double __x)
   ^~~
/usr/include/c++/6/cmath:85:3: note:   candidate expects 1 argument, 2 provided
/in/foo.cc:18:41: error: no matching function for call to 'abs(__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type, __gnu_cxx::__alloc_traits<std::allocator<int> >::value_type)'
    an += min(abs(v[i]-v[i-1],v[i]-v[i+1]));
                                         ^
In file included from /usr/include/c++/6/cstdlib:75:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:47,
                 from /in/foo.cc:2:
/usr/include/stdlib.h:735:12: note: candidate: int abs(int)
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
            ^~~
/usr/include/stdlib.h:735:12: note:   candidate expects 1 argument, 2 provided
In file included from /usr/include/c++/6/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95,
                 from /in/foo.cc:2:
/usr/include/c++/6/bits/valarray_after.h:442:5: note: candidate: template<class _Tp> std::_Expr<std::_UnClos<std::_Abs, std::_ValArray, _Tp>, _Tp> std::abs(const std::valarray<_Tp>&)
     _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs)
     ^
/usr/include/c++/6/bits/valarray_after.h:442:5: note:   template argument deduction/substitution failed:
/in/foo.cc:18:41: note:   mismatched types 'const std::valarray<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
    an += min(abs(v[i]-v[i-1],v[i]-v[i+1]));
                                         ^
In file included from /usr/include/c++/6/valarray:587:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:95,
                 from /in/foo.cc:2:
/usr/include/c++/6/bits/valarray_after.h:442:5: note: candidate: template<class _Dom> std::_Expr<std::_UnClos<std::_Abs, std::_Expr, _Dom>, typename _Dom::value_type> std::abs(const std::_Expr<_Dom1, typename _Dom1::value_type>&)
     _DEFINE_EXPR_UNARY_FUNCTION(abs, _Abs)
     ^
/usr/include/c++/6/bits/valarray_after.h:442:5: note:   template argument deduction/substitution failed:
/in/foo.cc:18:41: note:   mismatched types 'const std::_Expr<_Dom1, typename _Dom1::value_type>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
    an += min(abs(v[i]-v[i-1],v[i]-v[i+1]));
                                         ^
In file included from /usr/include/c++/6/ccomplex:39:0,
                 from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:52,
                 from /in/foo.cc:2:
/usr/include/c++/6/complex:597:5: note: candidate: template<class _Tp> _Tp std::abs(const std::complex<_Tp>&)
     abs(const complex<_Tp>& __z) { return __complex_abs(__z.__rep()); }
     ^~~
/usr/include/c++/6/complex:597:5: note:   template argument deduction/substitution failed:
/in/foo.cc:18:41: note:   mismatched types 'const std::complex<_Tp>' and '__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}'
    an += min(abs(v[i]-v[i-1],v[i]-v[i+1]));
                                         ^
In file included from /usr/include/x86_64-linux-gnu/c++/6/bits/stdc++.h:47:0,
                 from /in/foo.cc:2:
/usr/include/c++/6/cstdlib:180:3: note: candidate: long long int std::abs(long long int)
   abs(long long __x) { return __builtin_llabs (__x); }
   ^~~
/usr/include/c++/6/cstdlib:180:3: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/6/cstdlib:172:3: note: candidate: long int std::abs(long int)
   abs(long __i) { return __builtin_labs(__i); }
   ^~~
/usr/include/c++/6/cstdlib:172:

信息

递交者
类型
递交
题目
P1615 旅行
语言
C++
递交时间
2019-08-25 15:56:10
评测时间
2019-08-25 15:56:10
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes