Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

不知道是不是这个原因,可以试一下

Posted by 6262369 at 2018-08-09 15:49:13 on Problem 2187
	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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator