QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#689768 | #9434. Italian Cuisine | Liangsheng298 | WA | 0ms | 3928kb | C++14 | 1.2kb | 2024-10-30 18:29:47 | 2024-10-30 18:29:48 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define double long double
double sqr(double x) {return x*x;}
const int maxn = 1e5 + 10;
const double eps = 1e-12;
int n;
double fcmp(double x){
if(fabs(x)<eps) return 0;
if(x>0) return 1;
return -1;
}
struct point{
double x,y;
double norm(){
return sqrt(sqr(x)+sqr(y));
}
}a[maxn],c;
double R;
point operator -(const point &a,const point &b){
return (point){a.x-b.x,a.y-b.y};
}
point operator +(const point &a,const point &b){
return (point){a.x+b.x,a.y+b.y};
}
double det(const point &a,const point &b) {return a.x*b.y-a.y*b.x;}
void solve(){
cin>>n;
cin>>c.x>>c.y>>R;
for(int i=0;i<n;i++){
cin>>a[i].x>>a[i].y;
}
double ans=0,now=0;
for(int l=0,r=l+1;l<n;l++){
if(l==r) {
r=(r+1)%n;
now=0;
}
while((r+1)%n!=l){
int rr=(r+1)%n;
double tmp=det(a[rr]-a[l],c-a[l]);
if(fcmp(tmp)<=0) break;
if(fcmp(tmp-(a[rr]-a[l]).norm()*R)<0) break;
now+=det(a[r]-a[l],a[rr]-a[l]);
r=rr;
}
ans=max(ans,now);
int ll=(l+1)%n;
now-=det(a[l]-a[r],a[ll]-a[r]);
}
printf("%.0Lf\n",ans);
}
int main(){
int T;
cin>>T;
while(T--){
solve();
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3928kb
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: 3812kb
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'