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 |
为什么会 run time errorIn Reply To:Re:好郁闷,改集合DP吧……sigh…… Posted by:fzszjs1z at 2007-01-08 22:11:26 为什么会 run time error {$R-,Q-,S-,I-} program Azuki_7; const maxn = 10; maxm = 100000; maxorder = 100000; maxbit = 10; zero = 1e-10; maxtest = 2; bit : array [ 1..maxbit ] of longint = ( 1 , 2 , 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 ); var map : array [ 1..maxn * maxn , 1..maxn * maxn] of record num : longint; code : extended; end; mapchildnum : array [ 1..maxn * maxn ] of longint; tmpmap : array [ 1..maxn * maxn , 1..maxn * maxn ] of extended; tmpmapnum : array [ 1..maxn * maxn , 1..maxn * maxn ] of longint; queue : array [ 1..maxm ] of extended; queuenum : array [ 1..maxm ] of longint; order : array [ 1..maxorder ] of longint; f : array [ boolean , 0..1 shl maxbit - 1 ] of extended; n , m : longint; test : longint; sign : longint; tmp : longint; t1 , t2 : longint; now : boolean; x : extended; tmp2 : extended; procedure sort ( l , r : longint ); var i , j : longint; begin i := l; j := r; x := queue [ ( l + r ) shr 1 ]; repeat while queue [ i ] > x do inc ( i ); while x > queue [ j ] do dec ( j ); if i <= j then begin tmp := queuenum [ i ]; queuenum [ i ] := queuenum [ j ]; queuenum [ j ] := tmp; tmp2 := queue [ i ]; queue [ i ] := queue [ j ]; queue [ j ] := tmp2; inc ( i ); dec ( j ); end; until i > j; if l < j then sort ( l , j ); if i < r then sort ( i , r ); end; procedure init; var i , j , k , l : longint; tmp : longint; begin read ( n , m ); fillchar ( order , sizeof ( order ) , 0 ); for i := 1 to n do begin for j := 1 to m do begin read ( queue [ j ] ); queuenum [ j ] := j; end; sort ( 1 , m ); for j := 1 to n do begin order [ queuenum [ j ] ] := -1; tmpmap [ i , j ] := queue [ j ]; tmpmapnum [ i , j ] := queuenum [ j ]; end; end; { make graph } sign := 0; for i := 1 to m do if order [ i ] = -1 then begin inc ( sign ); order [ i ] := sign; end; for i := 1 to sign do mapchildnum [ i ] := 0; for i := 1 to n do for j := 1 to n do begin tmp := order [ tmpmapnum [ i , j ] ]; inc ( mapchildnum [ tmp ] ); map [ tmp , mapchildnum [ tmp ] ] . num := i; map [ tmp , mapchildnum [ tmp ] ] . code := ln ( tmpmap [ i , j ] ); end; { make graph } t1 := sign; t2 := n; end; procedure main; var i , j , k : longint; begin for i := 0 to 1 shl n - 1 do f [ false , i ] := -1e4; f [ false , 0 ] := 0; now := true; for i := 1 to sign do begin now := not now; for j := 0 to 1 shl n - 1 do f [ not now , j ] := -1e4; for j := 0 to 1 shl n - 1 do if f [ now , j ] <> -1e4 then begin f [ not now , j ] := f [ now , j ]; for k := 1 to mapchildnum [ i ] do if ( j and bit [ map [ i , k ] . num ] = 0 ) and ( f [ now , j ] + map [ i , k ] . code > f [ not now , j or bit [ map [ i , k ] . num ] ] ) then f [ not now , j or bit [ map [ i , k ] . num ] ] := f [ now , j ] + map [ i , k ] . code; end; end; end; procedure print; begin now := not now; writeln ( exp ( f [ now , 1 shl n - 1 ] ) :0 :6 ); end; begin // assign ( input , 'xxx.in' ); // reset ( input ); repeat init; main; print; until seekeof ( input ); end. Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator