結果

問題 No.424 立体迷路
コンテスト
ユーザー %20
提出日時 2018-01-06 21:16:22
言語 Perl
(5.42.1)
コンパイル:
perl -cw _filename_
実行:
perl -X _filename_
結果
AC  
実行時間 9 ms / 2,000 ms
+ 563µs
コード長 429 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 403 ms
コンパイル使用メモリ 6,272 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-08-07 13:27:44
合計ジャッジ時間 2,256 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 5
other AC * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
Unquoted string "b" may clash with future reserved word at Main.pl line 4.
Unquoted string "b" may clash with future reserved word at Main.pl line 4.
Unquoted string "b" may clash with future reserved word at Main.pl line 4.
Unquoted string "b" may clash with future reserved word at Main.pl line 4.
Unquoted string "b" may clash with future reserved word at Main.pl line 4.
Unquoted string "b" may clash with future reserved word at Main.pl line 4.
Name "main::h" used only once: possible typo at Main.pl line 1.
Main.pl syntax OK

ソースコード

diff #
raw source code

($h,$w)=glob<>;
($sy,$sx,$gy,$gx)=glob<>;
++$sy;++$sx;++$gy;++$gx;
@b=map[map hex,b,b,/./g,b,b],(b x$w)x2,<>,(b x$w)x2;
@q=[$sy,$sx];
while(($Y,$X)=@{shift@q}){
	for([-1,0],[0,-1],[0,1],[1,0]){
		($dy,$dx)=@$_;
		if(abs($b[$Y][$X]-$b[$y=$Y+$dy][$x=$X+$dx])<=1){
			$_[$y][$x]++||push@q,[$y,$x]
		}
		if($b[$Y][$X]>$b[$y][$x] && $b[$Y][$X]==$b[$y+=$dy][$x+=$dx]){
			$_[$y][$x]++||push@q,[$y,$x]
		}
	}
}
print$_[$gy][$gx]?YES:NO
0