結果

問題 No.424 立体迷路
ユーザー %20%20
提出日時 2018-01-06 21:16:22
言語 Perl
(5.40.0)
結果
AC  
実行時間 16 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 351 ms
コンパイル使用メモリ 5,888 KB
実行使用メモリ 6,144 KB
最終ジャッジ日時 2024-07-05 07:15:08
合計ジャッジ時間 1,412 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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 #

($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