結果

問題 No.307 最近色塗る問題多くない?
ユーザー tailstails
提出日時 2015-11-27 23:09:09
言語 Perl
(5.38.2)
結果
TLE  
実行時間 -
コード長 382 bytes
コンパイル時間 209 ms
コンパイル使用メモリ 5,256 KB
実行使用メモリ 18,848 KB
最終ジャッジ日時 2023-10-12 00:35:15
合計ジャッジ時間 5,947 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,616 KB
testcase_01 AC 3 ms
4,512 KB
testcase_02 AC 3 ms
4,708 KB
testcase_03 AC 2 ms
4,544 KB
testcase_04 AC 12 ms
6,248 KB
testcase_05 AC 4 ms
4,776 KB
testcase_06 AC 4 ms
4,820 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

($h,$w)=<>=~/\d+/g;
for$y(1..$h){
	@f{map"$_,$y",1..$w}=<>=~/\d/g;
}

sub f{
	my($x,$y)=@_;
	if($x>0&&$x<=$w&&$y>0&&$y<=$h){
		if($f{"$x,$y"}==$c){
			$f{"$x,$y"}=$d;
			f($x-1,$y);
			f($x+1,$y);
			f($x,$y-1);
			f($x,$y+1);
		}
	}
}

for(1..<>){
	($y,$x,$d)=<>=~/\d+/g;
	if($f{"$x,$y"}!=$d){
		$c=1-$d;
		f($x,$y);
	}
}

for$y(1..$h){
	print join($",@f{map"$_,$y",1..$w}),$/;
}

0