| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:跪拜求挑错,谢……In Reply To:跪拜求挑错,谢…… Posted by:zhangsiliang880622 at 2010-08-24 10:55:13 > void convex(poly a,poly &b){
> b.n=0;
> sort(a.p,a.p+a.n);
> for(int i=0;i<a.n;++i){
> while(b.n>1&&cross(a.p[i],b.p[b.n-2],b.p[b.n-1])<0)--b.n;
<=0 把共线的去掉 否则要影响旋转卡壳的正确性 如果你直接枚举凸包 就不会wa
去掉共线的后可以证明旋转卡壳只需要比较ans=max(ans,dist(a.p[p],a.p[q]))就可以了 平行的情况会在对面被解决
> b.p[b.n++]=a.p[i];
> }
> int k=b.n;
> for(int i=a.n-2;i>=0;--i){
> while(b.n>k&&cross(a.p[i],b.p[b.n-2],b.p[b.n-1])<0)--b.n;
> b.p[b.n++]=a.p[i];
> }
> if(b.n>1)--b.n;
> b.p[b.n]=b.p[0];
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator