QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#740752 | #9434. Italian Cuisine | xsdgp | WA | 0ms | 3740kb | C++20 | 1.5kb | 2024-11-13 11:21:12 | 2024-11-13 11:21:13 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define double long double
#define endl '\n'
using namespace std;
int n;
double r;
double eps=1e-12;
struct VECTOR
{
int x,y;
double operator*(const VECTOR &v)const
{
return x*v.x+y*v.y;
}
double operator^(const VECTOR &v)const
{
return x*v.y-y*v.x;
}
};
struct POINT
{
int x,y;
VECTOR operator-(const POINT &p)const
{
return {x-p.x,y-p.y};
}
}p[2005],p0,o={0,0};
bool eq(double x,double y)
{
return abs(x-y)<=eps;
}
bool check(POINT p1,POINT p2)
{
VECTOR v1=p2-p1,v2=p0-p1;
double dis=(v1^v2)/sqrtl(v1*v1);
return dis>r;
}
void solve()
{
cin>>n;
cin>>p0.x>>p0.y>>r;
for(int i=0;i<n;i++)
cin>>p[i].x>>p[i].y;
int sum=0;
for(int i=0;i<n;i++)
sum+=((p[i]-o)^(p[(i+1)%n]-o));
int j=0,area=0,ans=0;
for(int i=0;i<n;i++)
{
while(check(p[i],p[(j+1)%n]))
{
area-=((p[j]-o)^(p[i]-o));
j=(j+1)%n;
area+=((p[j]-o)^(p[i]-o))+((p[(j-1+n)%n]-o)^(p[j]-o));
if(((p[j]-p[i])^(p0-p[i]))>0)ans=max(ans,area);
else ans=max(ans,sum-area);
}
area-=((p[i]-o)^(p[(i+1)%n]-o))+((p[j]-o)^(p[i]-o));
area+=((p[j]-o)^(p[(i+1)%n]-o));
}
cout<<ans<<endl;
}
signed main()
{
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
int T=1;
cin>>T;
while(T--)solve();
return 0;
}
/*
1
6
0 0 499999993
197878055 -535013568
696616963 -535013568
696616963 40162440
696616963 499999993
-499999993 499999993
-499999993 -535013568
*/
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3740kb
input:
3 5 1 1 1 0 0 1 0 5 0 3 3 0 5 6 2 4 1 2 0 4 0 6 3 4 6 2 6 0 3 4 3 3 1 3 0 6 3 3 6 0 3
output:
0 24 0
result:
wrong answer 1st numbers differ - expected: '5', found: '0'