結果

問題 No.496 ワープクリスタル (給料日前編)
ユーザー tailstails
提出日時 2017-03-24 23:03:07
言語 Perl
(5.38.2)
結果
AC  
実行時間 178 ms / 2,000 ms
コード長 372 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 5,324 KB
実行使用メモリ 5,500 KB
最終ジャッジ日時 2023-09-20 02:49:43
合計ジャッジ時間 2,981 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,396 KB
testcase_01 AC 6 ms
5,328 KB
testcase_02 AC 6 ms
5,180 KB
testcase_03 AC 6 ms
5,320 KB
testcase_04 AC 6 ms
5,100 KB
testcase_05 AC 6 ms
5,084 KB
testcase_06 AC 8 ms
5,232 KB
testcase_07 AC 6 ms
5,296 KB
testcase_08 AC 178 ms
5,220 KB
testcase_09 AC 178 ms
5,268 KB
testcase_10 AC 9 ms
5,152 KB
testcase_11 AC 9 ms
5,396 KB
testcase_12 AC 16 ms
5,184 KB
testcase_13 AC 22 ms
5,200 KB
testcase_14 AC 34 ms
5,232 KB
testcase_15 AC 23 ms
5,084 KB
testcase_16 AC 22 ms
5,088 KB
testcase_17 AC 44 ms
5,104 KB
testcase_18 AC 38 ms
5,220 KB
testcase_19 AC 36 ms
5,260 KB
testcase_20 AC 27 ms
5,116 KB
testcase_21 AC 14 ms
5,164 KB
testcase_22 AC 176 ms
5,296 KB
testcase_23 AC 177 ms
5,500 KB
testcase_24 AC 174 ms
5,424 KB
testcase_25 AC 174 ms
5,216 KB
testcase_26 AC 175 ms
5,256 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Name "main::n" used only once: possible typo at Main.pl line 1.
Main.pl syntax OK

ソースコード

diff #

($gx,$gy,$n,$f)=glob<>;
$d{$gy,$gx}=1;
for(<>){
	($xi,$yi,$ci)=glob;
	for$y(0..$gy){
		for$x(0..$gx){
			$xs=$x+$xi;
			$ys=$y+$yi;
			if($d{$ys,$xs} && (!$d{$y,$x} || $d{$y,$x}>$d{$ys,$xs}+$ci)){
				$d{$y,$x}=$d{$ys,$xs}+$ci
			}
		}
	}
}
$r=1e9;
for$y(0..$gy){
	for$x(0..$gx){
		if($d{$y,$x} && $r>$d{$y,$x}+($y+$x)*$f){
			$r=$d{$y,$x}+($y+$x)*$f;
		}
	}
}
print $r-1;
0