結果

問題 No.17 2つの地点に泊まりたい
ユーザー %20%20
提出日時 2017-07-18 01:20:33
言語 Perl
(5.38.2)
結果
AC  
実行時間 65 ms / 5,000 ms
コード長 389 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 6,812 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-23 02:20:41
合計ジャッジ時間 1,668 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,812 KB
testcase_01 AC 4 ms
6,944 KB
testcase_02 AC 7 ms
6,944 KB
testcase_03 AC 65 ms
6,940 KB
testcase_04 AC 10 ms
6,944 KB
testcase_05 AC 39 ms
6,944 KB
testcase_06 AC 25 ms
6,940 KB
testcase_07 AC 19 ms
6,940 KB
testcase_08 AC 64 ms
6,944 KB
testcase_09 AC 65 ms
6,940 KB
testcase_10 AC 56 ms
6,944 KB
testcase_11 AC 64 ms
6,944 KB
testcase_12 AC 4 ms
6,944 KB
testcase_13 AC 4 ms
6,940 KB
testcase_14 AC 4 ms
6,940 KB
testcase_15 AC 4 ms
6,940 KB
testcase_16 AC 4 ms
6,940 KB
testcase_17 AC 12 ms
6,944 KB
testcase_18 AC 53 ms
6,940 KB
testcase_19 AC 48 ms
6,940 KB
testcase_20 AC 8 ms
6,940 KB
testcase_21 AC 6 ms
6,940 KB
testcase_22 AC 59 ms
6,944 KB
testcase_23 AC 38 ms
6,944 KB
testcase_24 AC 49 ms
6,944 KB
testcase_25 AC 5 ms
6,940 KB
testcase_26 AC 58 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Unquoted string "inf" may clash with future reserved word at Main.pl line 4.
Unquoted string "inf" may clash with future reserved word at Main.pl line 18.
Main.pl syntax OK

ソースコード

diff #

sub min{$_[$_[1]<$_[0]]}
for$i(@N=0..-2+map$S[$_]=<>,0..<>){
	for$j(@N){
		$w[$i][$j]=inf;
	}
}
/ .* /,$w[$`][$&]=$w[$&][$`]=$' for<>;
for$m(@N){
	for$i(@N){
		for$j(@N){
			$w[$i][$j]=min(
				$w[$i][$j],
				$w[$i][$m]+$w[$m][$j]
			)
		}
	}
}
$\=inf;
for$x(@@=1..@S-3){
	for$y(@@){
		if($x-$y){
			$\=min(
				$\,
				$S[$x]+$S[$y]+$w[0][$x]+$w[$x][$y]+$w[$y][@S-2]
			)
		}
	}
}
print
0