# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
73810 | 2018-08-29T04:46:30 Z | KLPP | Soccer (JOI17_soccer) | C++14 | 컴파일 오류 |
0 ms | 0 KB |
#include<iostream> #include<stdio.h> using namespace std; typedef long long int lld; lld abs(lld x){ if(x>0)return x; return -x; } int main(){ int h,w; cin>>h>>w; lld a,b,c; cin>>a>>b>>c; int n; cin>>n; lld x1,y1; lld x2,y2; cin>>x1>>y1>>x2>>y2; lld ans=abs(x1-x2)+abs(y1-y2); ans*=c; ans=min(ans,abs(x1-x2)*c+abs(y1-y2)*a+b); ans=min(ans,abs(x1-x2)*a+b+abs(y1-y2)*c); cout<<ans<<endl; return 0; }
Compilation message
soccer.cpp: In function 'int main()': soccer.cpp:20:19: error: call of overloaded 'abs(lld)' is ambiguous lld ans=abs(x1-x2)+abs(y1-y2); ^ In file included from /usr/include/c++/7/cstdlib:75:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/stdlib.h:774:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ soccer.cpp:6:5: note: candidate: lld abs(lld) lld abs(lld x){ ^~~ In file included from /usr/include/c++/7/cstdlib:77:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/c++/7/bits/std_abs.h:56:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } ^~~ /usr/include/c++/7/bits/std_abs.h:61:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/7/bits/std_abs.h:70:3: note: candidate: constexpr double std::abs(double) abs(double __x) ^~~ /usr/include/c++/7/bits/std_abs.h:74:3: note: candidate: constexpr float std::abs(float) abs(float __x) ^~~ /usr/include/c++/7/bits/std_abs.h:78:3: note: candidate: constexpr long double std::abs(long double) abs(long double __x) ^~~ soccer.cpp:20:30: error: call of overloaded 'abs(lld)' is ambiguous lld ans=abs(x1-x2)+abs(y1-y2); ^ In file included from /usr/include/c++/7/cstdlib:75:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/stdlib.h:774:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ soccer.cpp:6:5: note: candidate: lld abs(lld) lld abs(lld x){ ^~~ In file included from /usr/include/c++/7/cstdlib:77:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/c++/7/bits/std_abs.h:56:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } ^~~ /usr/include/c++/7/bits/std_abs.h:61:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/7/bits/std_abs.h:70:3: note: candidate: constexpr double std::abs(double) abs(double __x) ^~~ /usr/include/c++/7/bits/std_abs.h:74:3: note: candidate: constexpr float std::abs(float) abs(float __x) ^~~ /usr/include/c++/7/bits/std_abs.h:78:3: note: candidate: constexpr long double std::abs(long double) abs(long double __x) ^~~ soccer.cpp:22:23: error: call of overloaded 'abs(lld)' is ambiguous ans=min(ans,abs(x1-x2)*c+abs(y1-y2)*a+b); ^ In file included from /usr/include/c++/7/cstdlib:75:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/stdlib.h:774:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ soccer.cpp:6:5: note: candidate: lld abs(lld) lld abs(lld x){ ^~~ In file included from /usr/include/c++/7/cstdlib:77:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/c++/7/bits/std_abs.h:56:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } ^~~ /usr/include/c++/7/bits/std_abs.h:61:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/7/bits/std_abs.h:70:3: note: candidate: constexpr double std::abs(double) abs(double __x) ^~~ /usr/include/c++/7/bits/std_abs.h:74:3: note: candidate: constexpr float std::abs(float) abs(float __x) ^~~ /usr/include/c++/7/bits/std_abs.h:78:3: note: candidate: constexpr long double std::abs(long double) abs(long double __x) ^~~ soccer.cpp:22:36: error: call of overloaded 'abs(lld)' is ambiguous ans=min(ans,abs(x1-x2)*c+abs(y1-y2)*a+b); ^ In file included from /usr/include/c++/7/cstdlib:75:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/stdlib.h:774:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ soccer.cpp:6:5: note: candidate: lld abs(lld) lld abs(lld x){ ^~~ In file included from /usr/include/c++/7/cstdlib:77:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/c++/7/bits/std_abs.h:56:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } ^~~ /usr/include/c++/7/bits/std_abs.h:61:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/7/bits/std_abs.h:70:3: note: candidate: constexpr double std::abs(double) abs(double __x) ^~~ /usr/include/c++/7/bits/std_abs.h:74:3: note: candidate: constexpr float std::abs(float) abs(float __x) ^~~ /usr/include/c++/7/bits/std_abs.h:78:3: note: candidate: constexpr long double std::abs(long double) abs(long double __x) ^~~ soccer.cpp:23:23: error: call of overloaded 'abs(lld)' is ambiguous ans=min(ans,abs(x1-x2)*a+b+abs(y1-y2)*c); ^ In file included from /usr/include/c++/7/cstdlib:75:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/stdlib.h:774:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ soccer.cpp:6:5: note: candidate: lld abs(lld) lld abs(lld x){ ^~~ In file included from /usr/include/c++/7/cstdlib:77:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/c++/7/bits/std_abs.h:56:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } ^~~ /usr/include/c++/7/bits/std_abs.h:61:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/7/bits/std_abs.h:70:3: note: candidate: constexpr double std::abs(double) abs(double __x) ^~~ /usr/include/c++/7/bits/std_abs.h:74:3: note: candidate: constexpr float std::abs(float) abs(float __x) ^~~ /usr/include/c++/7/bits/std_abs.h:78:3: note: candidate: constexpr long double std::abs(long double) abs(long double __x) ^~~ soccer.cpp:23:38: error: call of overloaded 'abs(lld)' is ambiguous ans=min(ans,abs(x1-x2)*a+b+abs(y1-y2)*c); ^ In file included from /usr/include/c++/7/cstdlib:75:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/stdlib.h:774:12: note: candidate: int abs(int) extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; ^~~ soccer.cpp:6:5: note: candidate: lld abs(lld) lld abs(lld x){ ^~~ In file included from /usr/include/c++/7/cstdlib:77:0, from /usr/include/c++/7/ext/string_conversions.h:41, from /usr/include/c++/7/bits/basic_string.h:6349, from /usr/include/c++/7/string:52, from /usr/include/c++/7/bits/locale_classes.h:40, from /usr/include/c++/7/bits/ios_base.h:41, from /usr/include/c++/7/ios:42, from /usr/include/c++/7/ostream:38, from /usr/include/c++/7/iostream:39, from soccer.cpp:1: /usr/include/c++/7/bits/std_abs.h:56:3: note: candidate: long int std::abs(long int) abs(long __i) { return __builtin_labs(__i); } ^~~ /usr/include/c++/7/bits/std_abs.h:61:3: note: candidate: long long int std::abs(long long int) abs(long long __x) { return __builtin_llabs (__x); } ^~~ /usr/include/c++/7/bits/std_abs.h:70:3: note: candidate: constexpr double std::abs(double) abs(double __x) ^~~ /usr/include/c++/7/bits/std_abs.h:74:3: note: candidate: constexpr float std::abs(float) abs(float __x) ^~~ /usr/include/c++/7/bits/std_abs.h:78:3: note: candidate: constexpr long double std::abs(long double) abs(long double __x) ^~~