QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#740893 | #9434. Italian Cuisine | xsdgp | WA | 13ms | 3756kb | C++20 | 1.6kb | 2024-11-13 12:09:47 | 2024-11-13 12:09:47 |
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||eq(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[i]-p[(i-1+n)%n])^(p[(i+1)%n]-p[i]))==0)continue;
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
1
4
3 2 1
3 0
6 3
3 6
0 3
*/
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3756kb
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:
5 24 0
result:
ok 3 number(s): "5 24 0"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3684kb
input:
1 6 0 0 499999993 197878055 -535013568 696616963 -535013568 696616963 40162440 696616963 499999993 -499999993 499999993 -499999993 -535013568
output:
0
result:
ok 1 number(s): "0"
Test #3:
score: -100
Wrong Answer
time: 13ms
memory: 3696kb
input:
6666 19 -142 -128 26 -172 -74 -188 -86 -199 -157 -200 -172 -199 -186 -195 -200 -175 -197 -161 -188 -144 -177 -127 -162 -107 -144 -90 -126 -87 -116 -86 -104 -89 -97 -108 -86 -125 -80 -142 -74 -162 -72 16 -161 -161 17 -165 -190 -157 -196 -154 -197 -144 -200 -132 -200 -128 -191 -120 -172 -123 -163 -138...
output:
5093 3086 2539 668 3535 7421 4883 5711 5624 1034 2479 3920 4372 2044 4996 4569 2251 4382 4175 1489 1154 3231 4038 1631 5086 14444 1692 6066 687 1512 4849 5456 2675 8341 8557 8235 1013 5203 10853 6042 6300 4480 2303 2728 1739 2187 3385 4266 6322 909 4334 1518 948 5036 1449 2376 3180 4810 1443 1786 47...
result:
wrong answer 16th numbers differ - expected: '5070', found: '4569'