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:求助poj1991的Dp方程

Posted by 597100700 at 2011-10-09 21:34:41 on Problem 1991
In Reply To:Re:求助poj1991的Dp方程 Posted by:597100700 at 2011-10-09 21:34:00
> 先按照Pi排序。F[i][j][0..1]表示第i个教室与第j个教室之间的作业还没收过,0表示在教室i,1表示在教室j的最小时间。
for a:=1 to n do
 for b:=n downto a do
  begin
  if a>1 then
  f[a,b,0]:=min(f[a,b,0],max(f[a-1,b,0]+x[a]-x[a-1],y[a]));
  if b<n then
  f[a,b,0]:=min(f[a,b,0],max(f[a,b+1,1]+x[b+1]-x[a],y[a]));
  if b<n then
  f[a,b,1]:=min(f[a,b,1],max(f[a,b+1,1]+x[b+1]-x[b],y[b]));
  if a>1 then
  f[a,b,1]:=min(f[a,b,1],max(f[a-1,b,0]+x[b]-x[a-1],y[b]));
  end;

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