QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#617682 | #9434. Italian Cuisine | Emotion_Z | Compile Error | / | / | C++20 | 2.4kb | 2024-10-06 16:38:13 | 2024-10-06 16:38:14 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int __int128
#define deg( x ) cerr<<""#x"="<<x<<endl
#define endl '\n'
const int N=1e5+10;
istream &operator>>( istream &in , __int128 &n ){
string s; in>>s;
n=0;
for(char i:s) n=n*10+i-'0';
return in;
}
ostream &operator<<( ostream &out , __int128 n ){
if( n==0 ){
out<<0;
return out;
}
string s;
while( n ){
s+='0'+n%10;
n/=10;
}
reverse( s.begin( ) , s.end( ) );
out<<s;
return out;
}
struct node{
int x , y;
};
node A[ N ];
int cross( node a , node b , node c ){
return ( b.x-a.x )*( c.y-a.y )-( b.y-a.y )*( c.x-a.x );
}
bool pan( int sx , int sy , int r , node a , node b ){
if( cross( a , b , { sx , sy } ) < 0 ) return false;
int a1=( b.y-a.y ) , b1=( a.x-b.x ) , c1=( b.x*a.y-a.x*b.y );
int d=abs( a1*sx + b1*sy + c1 );
d*=d;
r*=r;
r*=a1*a1+b1*b1;
return d >= r;
}
void solve(){
int n;
cin>>n;
int sx,sy,r;
cin>>sx>>sy>>r;
for( int i=1; i<=n; i++ ){
cin>>A[ i ].x>>A[ i ].y;
}
//if( pan( sx , sy , r , A[ 1 ] , A[ 2 ] ) ) cout<<"gg"<<endl;
int ans=0;
int ne=1;
int cnt=0;
for( int i=1; i<=n; i++ ){
if( ne==i ) ne=i+1;
if( ne==n+1 ) ne=1;
while( 1 ){
if( pan( sx , sy , r , A[ i ] , A[ ne ] ) ){
//cout<<i<<"->"<<ne<<endl;
int di=ne-1;
if( di==0 ) di=n;
//cout<<"+"<<i<<" "<<di<<" "<<ne<<endl;
//cout<<"++"<<cross( A[ i ] , A[ di ] , A[ ne ] )<<endl;
cnt+=abs( cross( A[ i ] , A[ di ] , A[ ne ] ) );
ne++;
if( ne==n+1 ) ne=1;
}
else{
ne--;
if( ne==0 ) ne=n;
break;
}
}
//cout<<"结束"<<i<<" "<<cnt<<endl;
ans=max( ans , cnt );
int tt=i+1;
if( tt>n ) tt=1;
cnt-=abs( cross( A[ ne ] , A[ i ] , A[ tt ] ) );
ne++; if( ne==n+1 ) ne=1;
}
cout<<ans<<endl;
}
signed main() {
ios::sync_with_stdio( 0 );
cin.tie( 0 ); cout.tie( 0 );
int T=1;
cin>>T;
while( T-- ){
solve();
}
return 0;
}
Details
answer.code: In function ‘bool pan(__int128, __int128, __int128, node, node)’: answer.code:51:14: error: call of overloaded ‘abs(__int128)’ is ambiguous 51 | int d=abs( a1*sx + b1*sy + c1 ); | ~~~^~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/13/cstdlib:79, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:42, from answer.code:1: /usr/include/stdlib.h:840:12: note: candidate: ‘int abs(int)’ 840 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ In file included from /usr/include/c++/13/cstdlib:81: /usr/include/c++/13/bits/std_abs.h:79:3: note: candidate: ‘constexpr long double std::abs(long double)’ 79 | abs(long double __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:75:3: note: candidate: ‘constexpr float std::abs(float)’ 75 | abs(float __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:71:3: note: candidate: ‘constexpr double std::abs(double)’ 71 | abs(double __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:61:3: note: candidate: ‘long long int std::abs(long long int)’ 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/13/bits/std_abs.h:56:3: note: candidate: ‘long int std::abs(long int)’ 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ answer.code: In function ‘void solve()’: answer.code:87:25: error: call of overloaded ‘abs(__int128)’ is ambiguous 87 | cnt+=abs( cross( A[ i ] , A[ di ] , A[ ne ] ) ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stdlib.h:840:12: note: candidate: ‘int abs(int)’ 840 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ /usr/include/c++/13/bits/std_abs.h:79:3: note: candidate: ‘constexpr long double std::abs(long double)’ 79 | abs(long double __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:75:3: note: candidate: ‘constexpr float std::abs(float)’ 75 | abs(float __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:71:3: note: candidate: ‘constexpr double std::abs(double)’ 71 | abs(double __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:61:3: note: candidate: ‘long long int std::abs(long long int)’ 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/13/bits/std_abs.h:56:3: note: candidate: ‘long int std::abs(long int)’ 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~ answer.code:106:17: error: call of overloaded ‘abs(__int128)’ is ambiguous 106 | cnt-=abs( cross( A[ ne ] , A[ i ] , A[ tt ] ) ); | ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/stdlib.h:840:12: note: candidate: ‘int abs(int)’ 840 | extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur; | ^~~ /usr/include/c++/13/bits/std_abs.h:79:3: note: candidate: ‘constexpr long double std::abs(long double)’ 79 | abs(long double __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:75:3: note: candidate: ‘constexpr float std::abs(float)’ 75 | abs(float __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:71:3: note: candidate: ‘constexpr double std::abs(double)’ 71 | abs(double __x) | ^~~ /usr/include/c++/13/bits/std_abs.h:61:3: note: candidate: ‘long long int std::abs(long long int)’ 61 | abs(long long __x) { return __builtin_llabs (__x); } | ^~~ /usr/include/c++/13/bits/std_abs.h:56:3: note: candidate: ‘long int std::abs(long int)’ 56 | abs(long __i) { return __builtin_labs(__i); } | ^~~