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

WA了。不理解什么时候会NO的?感觉自己的算法没问题。

Posted by Jin_j_y at 2005-04-05 16:26:40 on Problem 2201
我用二分法做的,感觉不会出现“NO”的情况。
可是我的程序WA了。我的算法是这样的

int DC(int low,int high,int father){
	if(low==high)return 0;
	
	//为了满足堆序性,
	//找出[low..high)序列中含有最小a值的元素minp。

	//为了满足二叉排序树的性质,
	//把[low..high)序列按照minp的k值分成两个子集,
	//[low..temp)中的所有k值都小于minp的k值,
	//[temp..high)的所有k值都大于minp的k值。

	int left=DC(low,temp,minp);
	int right=DC(temp+1,high,minp);

	//确定当前minp结点的父亲,左右儿子

	return minp;
}

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