結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,632 KB
testcase_01 AC 4 ms
5,760 KB
testcase_02 AC 6 ms
5,632 KB
testcase_03 AC 67 ms
5,888 KB
testcase_04 AC 9 ms
5,632 KB
testcase_05 AC 39 ms
5,888 KB
testcase_06 AC 26 ms
5,888 KB
testcase_07 AC 19 ms
5,760 KB
testcase_08 AC 66 ms
6,144 KB
testcase_09 AC 65 ms
6,144 KB
testcase_10 AC 53 ms
6,016 KB
testcase_11 AC 65 ms
5,888 KB
testcase_12 AC 3 ms
5,760 KB
testcase_13 AC 3 ms
5,632 KB
testcase_14 AC 3 ms
5,632 KB
testcase_15 AC 4 ms
5,632 KB
testcase_16 AC 4 ms
5,632 KB
testcase_17 AC 11 ms
5,760 KB
testcase_18 AC 52 ms
5,760 KB
testcase_19 AC 47 ms
5,760 KB
testcase_20 AC 9 ms
5,760 KB
testcase_21 AC 6 ms
5,632 KB
testcase_22 AC 59 ms
5,888 KB
testcase_23 AC 38 ms
5,888 KB
testcase_24 AC 49 ms
5,888 KB
testcase_25 AC 5 ms
5,632 KB
testcase_26 AC 58 ms
6,016 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Unquoted string "inf" may clash with future reserved word at Main.pl line 5.
Unquoted string "inf" may clash with future reserved word at Main.pl line 21.
Main.pl syntax OK

ソースコード

diff #

sub min{$_[$_[1]<$_[0]]}
$S[$_]=<>for 0..<>-1;
for$i(@N=0..$#S){
	for$j(@N){
		$w[$i][$j]=inf;
	}
#	$w[$i][$i]=0;
}
<>;
/ .* /,$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-2){
	for$y(@@){
		if($x-$y){
			$\=min(
				$\,
				$S[$x]+$S[$y]+$w[0][$x]+$w[$x][$y]+$w[$y][$#S]
			)
		}
	}
}
print
0