QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#603613 | #9434. Italian Cuisine | Sound_Medium# | WA | 1ms | 5676kb | C++23 | 1.9kb | 2024-10-01 17:48:38 | 2024-10-01 17:48:39 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define double long double
using namespace std;
const int N=2e5+10;
const double eps=1e-13;
int n;
int x,y;int r;
struct Point{
int x,y;
Point(){}
Point(int xx,int yy){
x=xx,y=yy;
}
Point operator+(const Point &o)const{
return Point(x+o.x,y+o.y);
}
Point operator-(const Point &o)const{
return Point(x-o.x,y-o.y);
}
int operator*(const Point&o)const{
return x*o.x+y*o.y;
}
int operator^(const Point&o)const{
return x*o.y-y*o.x;
}
bool operator<(const Point&o)const{
if(x!=o.x)return x<o.x;
return y<o.y;
}
}p[N],st[N];
int xmult(Point p1,Point p2,Point p0){
return (p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y-p0.y);
}
bool check(Point x,Point a,Point b){
if((x-a)*(x-a)<r*r||(x-b)*(x-b)<r*r)return 1;
Point t=x;
t.x+=a.y-b.y;
t.y+=b.x-a.x;
int k=xmult(x,a,b);
return xmult(a,x,t)<=0&&k*k<=r*r*((b-a)*(b-a));
}
void solve () {
cin>>n;
cin>>x>>y>>r;
p[0]={x,y};
for(int i=1;i<=n;i++){
int x,y;
cin>>x>>y;
p[i]=p[n+i]={x,y};
}
int maxx=0,res;
vector<int>pre(2*n+2,0);
for(int i=2;i<=2*n;i++){
pre[i]=pre[i-1]+(p[i-1]^p[i]);
}
auto f=[&](int st,int ed)->bool {
{}
if(((p[ed]-p[st])^(p[0]-p[st]))>0&&!check(p[0],p[st],p[ed])){
return 1;
}
return 0;
};
for(int i=1;i<=n;i++){
int l=i+1,r=n+i-1;
while(l<r){
int mid=l+r+1>>1;
if(f(i,mid))l=mid;
else r=mid-1;
}
maxx=max(maxx,abs(pre[l]-pre[i]+(p[l]^p[i])));
}
cout<<maxx<<'\n';
}
signed main () {
ios::sync_with_stdio (false);
cin.tie (nullptr);
int T = 1;
cin >> T;
while (T --) {
solve ();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 5676kb
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:
12 24 0
result:
wrong answer 1st numbers differ - expected: '5', found: '12'