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

Re:用二分就可以了。

Posted by TheBeet at 2007-09-08 01:32:13 on Problem 1631
In Reply To:Re:不知道nlogn的dp是怎么搞的..哪位可否讲解下。 Posted by:enter2004 at 2007-09-08 01:19:10
tot = 0;
for (i = 1; i <= n; ++i)
{
	int lo = 0;
	int hi = tot + 1;
	while (lo + 1 < hi)
	{
		int mid = (lo + hi) >> 1;
		((ans[mid] < inp[i]) ? lo : hi) = mid;
	}
	ans[hi] = inp[i];
	if (hi > tot)
	{
		tot = hi;
	}
}

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