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 |
不知道是不是这个原因,可以试一下for(int i=n-2;i>0;i--)//求上凸壳时,n-1和0一定在栈中了,不要重复添加 { while(cnt>k&&cross(s[cnt-2],s[cnt-1],p[i])<=0) cnt--; s[cnt++]=p[i]; } 如果重复添加了,那么求最远距离是要覆盖栈顶(覆盖第二个0)来形成环 Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator