QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#597013#9434. Italian Cuisineucup-team3282#Compile Error//C++201.9kb2024-09-28 16:53:172024-09-28 16:53:17

Judging History

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

  • [2024-09-28 16:53:17]
  • 评测
  • [2024-09-28 16:53:17]
  • 提交

answer

#include<iostream>
#include<cstring>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<cmath>
#include<vector>
using namespace std;
#define pr pair<long long,long long>
#define x first
#define y second
deque<pr>que;
long long ans=0,anser=0;
pr pos;
long long rds;
pr a[1000050];
long long n;
long long S(pr a,pr b,pr c){
    long long x1,x2,y1,y2;
    x1=b.x-a.x;
    x2=c.x-a.x;
    y1=b.y-a.y;
    y2=c.y-a.y;
    return abs(x1*y2-y1*x2);
}
void PUSH(pair<long long,long long>p){
    // cout<<"PUSH"<<endl;
    ans=ans+S(que.front(),que.back(),p);
    que.push_back(p);
    return;
}
void POP(){
    // cout<<"POP"<<endl;
    pair<long long,long long>p=que.front();
    que.pop_front();
    ans-=S(que.front(),que.back(),p);
}
bool ch1(pr l,pr r){
    __int128 a,b,c;
    a=r.y-l.y;
    b=-(r.x-l.x);
    c=a*l.y+b*l.x;
    if(b==0){
        return abs(l.x-pos.x)>=rds;
    }
    if(a==0){
        return abs(l.y-pos.y)>=rds;
    }
    return (a*pos.x+b*pos.y+c)*(a*pos.x+b*pos.y+c)>=rds*rds*(a*a+b*b);
}
bool ch2(pr l,pr r){
    return (r.x-l.x)*(pos.y-l.y)-(pos.x-l.x)*(r.y-l.y)<0;
}
long long main(){
    long long t;cin>>t;while(t--){
        que.clear();
        ans=0;anser=0;
        cin>>n;
        cin>>pos.x>>pos.y>>rds;
        for(long long i=1;i<=n;i++){
            cin>>a[i].x>>a[i].y;
            a[i+n]=a[i];
        }
        que.push_back(a[1]);
        que.push_back(a[2]);
        for(long long i=3;i<=n+n;i++){
            PUSH(a[i]);
            while(que.size()>n)POP();
            while(que.size()>=3&&(ch1(que.front(),que.back())==false||ch2(que.front(),que.back())==true)){
                POP();
            }
            // cout<<ans<<endl;
            anser=max(anser,ans);
        }
        for(long long i=1;i<=2*n;i++){
            a[i]=a[0];
        }
        cout<<anser<<endl;
    }
    return 0;
}
/*

{
Ax1+By1+1=Ax0+By1+1;
A(x1+x0)=B()

}

*/

Details

cc1plus: error: ‘::main’ must return ‘int’