QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#686428#9434. Italian CuisinewangqingxianWA 1ms3672kbC++201.4kb2024-10-29 12:48:322024-10-29 12:48:32

Judging History

你现在查看的是最新测评结果

  • [2024-10-29 12:48:32]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3672kb
  • [2024-10-29 12:48:32]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define pii pair<int, int>
#define ar(i) array<int, i>
using namespace std;
const int N=1e6+5, mod=1e9+7;
struct point{
    int x,y;
}poi[N];
int get_s(point a,point b,point c){
    b.x-=a.x;
    b.y-=a.y;
    c.x-=a.x;
    c.y-=a.y;
    int s=abs(b.x*c.y-c.x*b.y);
    return s;
}
point cir;
int r;
bool incir(point a,point b){
    int len2=(a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y);
    int s=get_s(a,b,cir);
    return s*s<=r*r*len2;
}
bool incir(point a,point b,point c){
    int s1=get_s(a,b,cir);
    int s2=get_s(a,c,cir);
    int s3=get_s(c,b,cir);
    return s1+s2+s3==get_s(a,b,c);
}
int n;
int genshin;
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin>>genshin;
    while(genshin--){
        cin>>n>>cir.x>>cir.y>>r;
        for(int i=1;i<=n;++i){
            cin>>poi[i].x>>poi[i].y;
            poi[i+n]=poi[i];
        }
        int j=1;
        int ans=0;
        int mx=0;
        for(int i=3;i<=n*2;++i){
            ans+=get_s(poi[i],poi[i-1],poi[j]);
            while(i>j+1&&(i-j>=n||incir(poi[i],poi[j])||incir(poi[i],poi[j],poi[j+1]))){
                ans-=get_s(poi[i],poi[j],poi[j+1]);
                ++j;
            }
            if(!incir(poi[i],poi[j]))mx=max(mx,ans);
        }
        cout<<mx<<endl;
    }
    // cerr<<fixed<<setprecision(2)<<(double)clock()/CLOCKS_PER_SEC<<endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 3672kb

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: 3636kb

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'