Compiler output
prog.cpp: In function 'long long int f(std::vector<long long int>, std::vector<long long int>)':
prog.cpp:19:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<a.size();i++){
^
prog.cpp: In function 'long long int computeDist(std::vector<long long int>, std::vector<long long int>)':
prog.cpp:35:30: error: call of overloaded 'abs(__gnu_cxx::__alloc_traits<std::allocator<long long int> >::value_type)' is ambiguous
nr += abs(a[i] - b[i]);
^
prog.cpp:35:30: note: candidates are:
In file included from /usr/include/c++/4.9/cstdlib:72:0,
from /usr/include/c++/4.9/ext/string_conversions.h:41,
from /usr/include/c++/4.9/bits/basic_string.h:2850,
from /usr/include/c++/4.9/string:52,
from /usr/include/c++/4.9/bits/locale_classes.h:40,
from /usr/include/c++/4.9/bits/ios_base.h:41,
from /usr/include/c++/4.9/ios:42,
from /usr/include/c++/4.9/ostream:38,
from /usr/include/c++/4.9/iostream:39,
from prog.cpp:1:
/usr/include/stdlib.h:775:12: note: int abs(int)
extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
^
prog.cpp:26:11: note: long long int abs(long long int)
long long abs(long long a){
^
In file included from /usr/include/c++/4.9/random:38:0,
from /usr/include/c++/4.9/bits/stl_algo.h:66,
from /usr/include/c++/4.9/algorithm:62,
from prog.cpp:7:
/usr/include/c++/4.9/cmath:99:5: note: constexpr typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type std::abs(_Tp) [with _Tp = long long int; typename __gnu_cxx::__enable_if<std::__is_integer<_Tp>::__value, double>::__type = double]
abs(_Tp __x)
^
/usr/include/c++/4.9/cmath:91:3: note: constexpr long double std::abs(long double)
abs(long double __x)
^
/usr/include/c++/4.9/cmath:87:3: note: constexpr float std::abs(float)
abs(float __x)
^
/usr/include/c++/4.9/cmath:81:3: note: constexpr double std::abs(double)
abs(double __x)
^
In file included from /usr/include/c++/4.9/ext/string_conversions.h:41:0,
from /usr/include/c++/4.9/bits/basic_string.h:2850,
from /usr/include/c++/4.9/string:52,
from /usr/include/c++/4.9/bits/locale_classes.h:40,
from /usr/include/c++/4.9/bits/ios_base.h:41,
from /usr/include/c++/4.9/ios:42,
from /usr/include/c++/4.9/ostream:38,
from /usr/include/c++/4.9/iostream:39,
from prog.cpp:1:
/usr/include/c++/4.9/cstdlib:174:3: note: long long int std::abs(long long int)
abs(long long __x) { return __builtin_llabs (__x); }
^
/usr/include/c++/4.9/cstdlib:166:3: note: long int std::abs(long int)
abs(long __i) { return __builtin_labs(__i); }
^
prog.cpp: In function 'void compute()':
prog.cpp:92:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<poz.size();i++){
^
prog.cpp:106:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int i=0;i<poz2.size();i++){
^