結果

問題 No.1588 Connection
ユーザー tails
提出日時 2021-07-09 16:12:58
言語 Perl
(5.40.0)
結果
AC  
実行時間 115 ms / 2,000 ms
コード長 255 bytes
コンパイル時間 1,155 ms
コンパイル使用メモリ 6,944 KB
実行使用メモリ 25,220 KB
平均クエリ数 564.00
最終ジャッジ日時 2024-07-17 12:57:28
合計ジャッジ時間 3,825 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 31
権限があれば一括ダウンロードができます
コンパイルメッセージ
Possible precedence problem on bitwise & operator at Main.pl line 3.
Possible precedence problem on bitwise & operator at Main.pl line 3.
Possible precedence problem on bitwise & operator at Main.pl line 3.
Main.pl syntax OK

ソースコード

diff #

sub enq{
	my($y,$x)=@_;
	if($y>0&$y<=$n&$x>0&$x<=$n&&!$$y[$x]++){
		print"$y $x\n";
		push@s,[$y,$x]if<>=~B;
	}
}
$|=1;
$n+=<>;
enq(1,1);
while($_=pop@s){
	($y,$x)=@$_;
	enq($y+1,$x);
	enq($y,$x+1);
	enq($y,$x-1);
	enq($y-1,$x);
}
print$$n[$n]?Yes:No,$/;
0