結果

問題 No.460 裏表ちわーわ
ユーザー tailstails
提出日時 2016-12-11 00:23:08
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 496 ms
コンパイル使用メモリ 5,300 KB
実行使用メモリ 9,652 KB
最終ジャッジ日時 2023-08-19 10:51:39
合計ジャッジ時間 5,612 ms
ジャッジサーバーID
(参考情報)
judge10 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
9,528 KB
testcase_01 AC 10 ms
5,056 KB
testcase_02 AC 616 ms
5,156 KB
testcase_03 AC 6 ms
5,064 KB
testcase_04 AC 6 ms
5,168 KB
testcase_05 WA -
testcase_06 WA -
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

($m,$n)=glob<>;
push@a,[glob]for<>;
$b=99;

sub d {
	my($y,$x)=@_;
	for$j($y-1..$y+1){
		if($j>=0&&$j<$m){
			for$i($x-1..$x+1){
				if($i>=0&&$i<$n){
					$a[$j][$i]^=1;
				}
			}
		}
	}
}

sub f {
	my($y,$x,$c)=@_;
	if($x==$n){
		$x=0; ++$y;
		if($y>1){
			for$i(0..$n-1){
				if($a[$y-2][$i]){
					return;
				}
			}
		}
	}
	if($y==$m){
		for$j($y-2,$y-1){
			if($j>=0){
				for$i(0..$n-1){
					if($a[$j][$i]){
						return;
					}
				}
			}
		}
		if($b>$c){
			$b=$c;
		}
		return;
	}
	f($y,$x+1,$c);
	d($y,$x);
	f($y,$x+1,$c+1);
	d($y,$x);
}

f(0,0,0);
print $b;
0