QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#689735 | #9434. Italian Cuisine | Liangsheng298 | WA | 0ms | 3708kb | C++14 | 1.5kb | 2024-10-30 18:23:01 | 2024-10-30 18:23:02 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define LL long long
LL sqr(LL x) {return x*x;}
const int maxn = 2e5 + 10;
int n;
struct point{
LL x,y;
LL norm(){
return (sqr(x)+sqr(y));
}
}a[maxn],c;
LL R;
inline LL read(){
LL f=1;
LL x=0;
char ch=getchar();
while(!isdigit(ch)){
if(ch=='-')f=-1;
ch=getchar();
}
while(isdigit(ch))
x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
return x*=f;
}
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};
}
LL det(point a,point b) {return a.x*b.y-b.x*a.y;}
inline void print(LL x){
if(x<0){
x=~(x-1);
putchar('-');
}
if(x>9)
print(x/10);
putchar(x%10+'0');
}
void solve(){
cin>>n;
c.x=read();c.y=read();R=read();
for(int i=0;i<n;i++){
a[i].x=read();a[i].y=read();
}
LL ans=0,now=0;
for(int l=0,r=l+1;l<n;l++){
if(l==r) {
r=(l+1)%n;
now=0;
}
while((r+1)%n!=l){
int rr=(r+1)%n;
LL tmp=det(a[rr]-a[l],c-a[l]);
if(tmp<=0) break;
if(tmp*tmp<(a[rr]-a[l]).norm()*R*R) break;
point t1=a[r]-a[l],t2=a[rr]-a[l];
LL tmp2=t1.x*t2.y-t2.x*t1.y;
now+=tmp2;
r=rr;
}
ans=max(ans,now);
int ll=(l+1)%n;
LL tmp2=det(a[l]-a[r],a[ll]-a[r]);
assert(tmp2>=0);
now-=tmp2;
}
print(ans);
printf("\n");
}
int main(){
int T;
cin>>T;
while(T--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3708kb
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: 3664kb
input:
1 6 0 0 499999993 197878055 -535013568 696616963 -535013568 696616963 40162440 696616963 499999993 -499999993 499999993 -499999993 -535013568
output:
688265363857191648
result:
wrong answer 1st numbers differ - expected: '0', found: '688265363857191648'