求助点在凸包内的判定。
  • 板块学术版
  • 楼主Sharpsmile
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/9/12 11:53
  • 上次更新2024/9/12 18:57:12
查看原帖
求助点在凸包内的判定。
455490
Sharpsmile楼主2024/9/12 11:53
struct node{
    int x,y;
    friend ll operator *(const node A,const node B){
        return 1ll*A.x*B.y-1ll*A.y*B.x;
    } 
    friend node operator+(const node A,const node B){
        return {A.x+B.x,A.y+B.y};
    }
    friend node operator-(const node A,const node B){
        return {A.x-B.x,A.y-B.y};
    }
    friend bool operator ==(const node A,const node B){
        return A.x==B.x&&A.y==B.y;
    }
    inline long double ang(){
        return atan2(y,x);
    }
}A[600300];
vector<int>g[600300],P[600300];
inline bool chk(int id,node T){
    int k=P[id].size();
    for(int i=0;i+1<k;i++)
    if((A[P[id][i+1]]-A[P[id][i]])*(T-A[P[id][i]])<=0)return 0;
    return 1;
}

我在预处理的时候做过 P[s].push_back(P[s][0]),同时 P[id] 是逆时针顺序的。

但是这个东西我拿去某个题的暴力的时候他好像寄了,基本能确定是这里的问题。有无大佬给看看。

2024/9/12 11:53
加载中...