結果

問題 No.1974 2x2 Flipper
ユーザー tailstails
提出日時 2022-06-10 22:15:54
言語 Perl
(5.38.2)
結果
AC  
実行時間 333 ms / 2,000 ms
コード長 544 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 6,108 KB
実行使用メモリ 8,072 KB
最終ジャッジ日時 2023-10-21 05:58:01
合計ジャッジ時間 3,702 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
6,140 KB
testcase_01 AC 9 ms
6,172 KB
testcase_02 AC 7 ms
6,160 KB
testcase_03 AC 9 ms
7,232 KB
testcase_04 AC 9 ms
6,436 KB
testcase_05 AC 60 ms
6,144 KB
testcase_06 AC 9 ms
6,700 KB
testcase_07 AC 8 ms
6,436 KB
testcase_08 AC 8 ms
6,248 KB
testcase_09 AC 9 ms
6,968 KB
testcase_10 AC 24 ms
6,132 KB
testcase_11 AC 9 ms
6,704 KB
testcase_12 AC 10 ms
7,228 KB
testcase_13 AC 9 ms
6,700 KB
testcase_14 AC 8 ms
6,436 KB
testcase_15 AC 10 ms
7,496 KB
testcase_16 AC 26 ms
6,140 KB
testcase_17 AC 9 ms
6,964 KB
testcase_18 AC 8 ms
6,304 KB
testcase_19 AC 8 ms
6,248 KB
testcase_20 AC 8 ms
6,440 KB
testcase_21 AC 10 ms
7,760 KB
testcase_22 AC 10 ms
8,072 KB
testcase_23 AC 10 ms
7,760 KB
testcase_24 AC 333 ms
6,132 KB
testcase_25 AC 8 ms
6,136 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

($h,$w)=glob<>;
if($h&1){
	if($w&1){
		if($h>$w){
			print $h*($w-1),$/;
			for$y(1..$h){
				for$x(1..$w){
					print $x==($y<$w?$y:$w)?0:1;
					print $x==$w?$/:$";
				}
			}
		}else{
			print +($h-1)*$w,$/;
			for$y(1..$h){
				for$x(1..$w){
					print $y==($x<$h?$x:$h)?0:1;
					print $x==$w?$/:$";
				}
			}
		}
	}else{
		print +($h-1)*$w,$/;
		print "@{[(1)x$w]}\n"x($h-1);
		print "@{[(0)x$w]}\n";
	}
}else{
	if($w&1){
		print $h*($w-1),$/;
		print "@{[(1)x($w-1),0]}\n"x$h;
	}else{
		print $h*$w,$/;
		print "@{[(1)x$w]}\n"x$h;
	}
}
0