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

floyd水过……最长路

Posted by lqp18_31 at 2009-07-28 15:17:31 on Problem 2241 and last updated at 2009-07-28 15:18:30
拆成3个点
           for( int i=1 ; i<=tot; i++)
             for( int j=1 ; j<=tot; j++)
               if( a[ j ].b>a[ i ].b && a[ j ].a>a[ i ].a )
                 map[ j ][ i ]=a[ i ].h+a[ j ].h;      建边

           for( int k=1 ; k<=tot ;k++)
             for( int i=1 ; i<=tot ; i++)
               for( int j=1 ; j<=tot ; j++)
               if( i!=j ){
                 map[ i ][ j ]=max( map[ i ][ j ] , map[ i ][ k ]+map[ k ][ j ]-a[ k ].h );
                 ans=max( ans , map[ i ][ j ] );
               }          floyd最长路

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