标签:i++ ble AC for double size down div point
struct point { double x,y; }a[Max]; bool cmp(point a,point b) { if(a.x!=b.x) return a.x<b.x; //按照x从小到大排序 return a.y<b.y; //x相同按照y } int chaji(point a,point b,point c) { a.x=c.x-a.x; a.y=c.y-a.y; b.x=c.x-b.x; b.y=c.y-b.y; if(a.x*b.y-b.x*a.y<1e-9) return 1; //如果叉积小于0在顺时针方向 return 0; } void solve() { vector <point> up; //构件凸包上部 vector <point> down; //构造凸包下部 up.push_back(a[0]); up.push_back(a[1]); down.push_back(a[n-1]); down.push_back(a[n-2]); for(int i=2;i<n;i++) { for(int j=up.size();j>=2&&chaji(up[j-2],up[j-1],a[i])!=1;j--) up.pop_back(); //将不能构成顺时针的去掉 up.push_back(a[i]); //重新加入一个点 } for(int i=n-3;i>=0;i--) { for(int j=down.size();j>=2&&chaji(down[j-2],down[j-1],a[i])!=1;j--) down.pop_back(); down.push_back(a[i]); } for(int i=down.size()-2;i>=1;i--) up.push_back(down[i]); } int m
标签:i++ ble AC for double size down div point
原文地址:https://www.cnblogs.com/ww123/p/9038463.html