QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#603573 | #9434. Italian Cuisine | Sound_Medium# | WA | 0ms | 5896kb | C++23 | 1.8kb | 2024-10-01 17:27:29 | 2024-10-01 17:27:29 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
// #define intlong double
using namespace std;
const int N=2e5+10;
int n;
int x,y;long double 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];
bool check(Point x,Point a,Point b){
Point v1=b-a,v2=x-a;
long double k=v1^v2;
long double L=sqrtl((long double)(v1*v1));
k=fabs(k/L);
// cerr<<k<<endl;
// cerr<<r<<endl;
if(k-r> -(1e-15)){
return 1;
}
else return 0;
}
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: 100
Accepted
time: 0ms
memory: 5896kb
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: 0ms
memory: 5828kb
input:
1 6 0 0 499999993 197878055 -535013568 696616963 -535013568 696616963 40162440 696616963 499999993 -499999993 499999993 -499999993 -535013568
output:
286862654137719264
result:
wrong answer 1st numbers differ - expected: '0', found: '286862654137719264'