結果

問題 No.323 yuki国
ユーザー tailstails
提出日時 2015-12-16 23:17:13
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 950 bytes
コンパイル時間 391 ms
コンパイル使用メモリ 5,332 KB
実行使用メモリ 5,096 KB
最終ジャッジ日時 2023-10-14 11:10:57
合計ジャッジ時間 1,996 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,760 KB
testcase_01 AC 3 ms
4,716 KB
testcase_02 AC 3 ms
4,588 KB
testcase_03 AC 3 ms
4,672 KB
testcase_04 AC 3 ms
4,596 KB
testcase_05 AC 3 ms
4,856 KB
testcase_06 AC 3 ms
4,608 KB
testcase_07 AC 3 ms
4,856 KB
testcase_08 AC 3 ms
4,728 KB
testcase_09 AC 3 ms
4,736 KB
testcase_10 AC 3 ms
4,852 KB
testcase_11 AC 2 ms
4,788 KB
testcase_12 WA -
testcase_13 AC 40 ms
5,048 KB
testcase_14 AC 2 ms
4,804 KB
testcase_15 AC 26 ms
5,036 KB
testcase_16 AC 37 ms
4,932 KB
testcase_17 AC 3 ms
4,624 KB
testcase_18 AC 3 ms
4,904 KB
testcase_19 AC 3 ms
4,740 KB
testcase_20 AC 3 ms
4,780 KB
testcase_21 AC 3 ms
4,784 KB
testcase_22 AC 3 ms
4,720 KB
testcase_23 AC 3 ms
4,768 KB
testcase_24 AC 48 ms
4,800 KB
testcase_25 AC 3 ms
4,848 KB
testcase_26 WA -
testcase_27 AC 3 ms
4,776 KB
testcase_28 AC 45 ms
4,908 KB
testcase_29 AC 44 ms
5,040 KB
testcase_30 AC 3 ms
4,760 KB
testcase_31 AC 3 ms
4,612 KB
testcase_32 AC 3 ms
4,592 KB
testcase_33 AC 3 ms
4,724 KB
testcase_34 WA -
testcase_35 AC 3 ms
4,896 KB
testcase_36 AC 3 ms
4,716 KB
testcase_37 AC 3 ms
4,704 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

sub e{
	$i=@q;
	$q[$i]=$q[$j],$i=$j while $i&&$q[$j=$i-1>>1]<$_[0];
	$q[$i]=$_[0];
}
sub d{
	$x=$q[0];
	$y=pop@q;
	if(@q){
		$i=0;
		$q[$i]=$q[$j],$i=$j while($j=$i*2+1)<@q&&$q[$j+1<@q&&$q[$j]<$q[$j+1]?++$j:$j]>$y;
		$q[$i]=$y;
	}
	$x;
}
sub g{
	my($a,$y,$x)=@_;
	if($y>=0&&$y<$h&&$x>=0&&$x<$w){
		$a+=vec($m[$y],$x,8)==$yu?1:-1;
		if($a>0||$y==$gy&&$x==$gx){
			e($a<<16|$y<<8|$x);
		}
	}
}
sub f{
	my($a,$y,$x)=@_;
	@q=();
	&g;
	while(@q){
		$t=d;
		$a=$t>>16;
		$y=$t>>8&255;
		$x=$t&255;
		return 1 if $y==$gy&&$x==$gx&&$a>=$gb;
		if($d[$y][$x]){
			return 1 if $d[$y][$x]<$a;
		}else{
			$d[$y][$x]=$a;
			g($a,$y,$x-1);
			g($a,$y,$x+1);
			g($a,$y-1,$x);
			g($a,$y+1,$x);
		}
	}
}
sub i{<>=~/\d+/g}
($h,$w)=i;
($a,$si,$sj)=i;
($b,$gi,$gj)=i;
if(!($a+$si+$sj+$b+$gi+$gj&1)){
	@m=<>;
	$a-=vec($m[$si],$sj,8)==42?1:-1;
	$yu=42;$gy=$gi;$gx=$gj;$gb=$b;
	$b1=f($a,$si,$sj);
	$yu=46;$gy=$si;$gx=$sj;$gb=$a;
	$b2=f($b,$gi,$gj);
}
print$b1*$b2?Yes:No
0