QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#610758 | #9434. Italian Cuisine | jack | WA | 1ms | 3596kb | C++14 | 2.4kb | 2024-10-04 17:18:03 | 2024-10-04 17:18:34 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define PI acos(-1)
const int N=1e5+10;
typedef long long ll;
ll r;
struct point
{
ll x,y;
}p[N];
point C;
point operator+(point a,point b)
{
point s;
s.x=a.x+b.x;
s.y=a.y+b.y;
return s;
}
point operator-(point a,point b)
{
point s;
s.x=a.x-b.x;
s.y=a.y-b.y;
return s;
}
point operator*(point a,double t)
{
point s;
s.x=a.x*t;
s.y=a.y*t;
return s;
}
double dot(point a,point b)//向量点积 判断角度问题
{
return a.x*b.x+a.y*b.y;
}
double len(point a)
{
return sqrt(a.x*a.x+a.y*a.y);
}
double angle(point a,point b) //相量间夹角
{
return acos(dot(a,b)/len(a)/len(b));
}
double operator*(point a,point b)
{
return a.x*b.y-a.y*b.x;
}
ll cross(point a,point b,point c)
{
return (b-a)*(c-a);
}
ll dis(point a,point b)
{
return (a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
}
bool dis1(point a,point b,point c)
{
ll d=cross(a,b,c);
ll f=d*d;
ll g=r*r*dis(b,c);
return f<g;
}
//直线ab与线段cd的关系
//cross(a,b,c)*cross(a,b,d)>0 无交点
//cross(a,b,c)*cross(a,b,d)<=0 有交点
//线段ab与线段cd
//cross(a,b,c)*cross(a,b,d)>0或cross(c,d,a)*cross(c,d,b)>0 无交点
point getNode(point a,point u,point b,point v)
{
double t=(a-b)*v/(v*u);
point s=a+u*t;
return s;
}
//以向量ABC构成的平行四边形的面积
double Area2(point a,point b,point c)
{
return (b-a)*(c-a);
}
point rotate(point a,double b)
{
double A=a.x*cos(b)-a.y*sin(b);
double B=a.x*sin(b)+a.y*cos(b);
point s;
s.x=A;
s.y=B;
return s;
}
void solve()
{
int n;
cin>>n;
cin>>C.x>>C.y>>r;
for(int i=1;i<=n;i++) cin>>p[i].x>>p[i].y;
ll ans=0;
ll fans=0;
for(int i=1,j=i+1;i<=n;i++)
{
while(1)
{
int f=j%n+1;
//cout<<i<<' '<<j<<' '<<f<<' '<<cross(p[i],p[f],C)<<' '<<dis1(C,p[i],p[f])<<' '<<cross(p[i],p[j],p[f])<<endl;
if(cross(p[i],p[f],C)<=0) break;
if(dis1(C,p[i],p[f])) break;
ans+=(ll)(cross(p[i],p[j],p[f]));
//cout<<i<<' '<<j<<' '<<f<<endl;
j=f;
}
//cout<<ans<<endl;
//cout<<i<<' '<<j<<endl;
fans=max(fans,ans);
int d=i%n+1;
ans-=cross(p[i],p[d],p[j]);
}
cout<<fans<<'\n';
}
int main()
{
int t;
cin>>t;
while(t--) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3596kb
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: -100
Wrong Answer
time: 1ms
memory: 3592kb
input:
1 6 0 0 499999993 197878055 -535013568 696616963 -535013568 696616963 40162440 696616963 499999993 -499999993 499999993 -499999993 -535013568
output:
550249412925348672
result:
wrong answer 1st numbers differ - expected: '0', found: '550249412925348672'