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

受不了了........看看我的O(CLogC)的主过程有什么不对吧.....

Posted by Bluebird at 2005-07-21 20:21:17 on Problem 2500
 已排序
 cc[i](0<=i<=c-1)为第i个可选点
 p为前半弧指针,q为后半弧指针,mid为弧的中间点
 getarea计算三点组成的面积
 getmax得到两数的较大值
 area保存着最优值

		p = 1;
		q = 2;
		area = 0;
		for (i = 2; i < c - 1; i ++)
		{
			mid = cc[i] / 2;
			while ((p < i - 1) && (cc[p] < mid)) p ++;
			now = getmax(getarea(0, cc[i], cc[p]), getarea(0, cc[i], cc[p - 1]));
			mid = (n + cc[i]) / 2;
			while ((q < c - 1) && (cc[q] < mid)) q ++;
			now += getmax(getarea(0, cc[i], cc[q]), getarea(0, cc[i], cc[q - 1]));
			area = getmax(area, now);
		}

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