| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
floyd水过……最长路拆成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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator