結果

問題 No.506 限られたジャパリまん
ユーザー tailstails
提出日時 2020-11-05 12:39:47
言語 Perl
(5.38.2)
結果
AC  
実行時間 789 ms / 2,000 ms
コード長 415 bytes
コンパイル時間 56 ms
コンパイル使用メモリ 5,340 KB
実行使用メモリ 5,428 KB
最終ジャッジ日時 2023-09-10 12:56:59
合計ジャッジ時間 5,135 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 6 ms
5,228 KB
testcase_01 AC 7 ms
5,356 KB
testcase_02 AC 7 ms
5,196 KB
testcase_03 AC 6 ms
5,380 KB
testcase_04 AC 20 ms
5,360 KB
testcase_05 AC 14 ms
5,240 KB
testcase_06 AC 7 ms
5,188 KB
testcase_07 AC 13 ms
5,424 KB
testcase_08 AC 789 ms
5,372 KB
testcase_09 AC 348 ms
5,132 KB
testcase_10 AC 16 ms
5,124 KB
testcase_11 AC 711 ms
5,380 KB
testcase_12 AC 424 ms
5,112 KB
testcase_13 AC 6 ms
5,176 KB
testcase_14 AC 11 ms
5,240 KB
testcase_15 AC 7 ms
5,172 KB
testcase_16 AC 664 ms
5,324 KB
testcase_17 AC 26 ms
5,216 KB
testcase_18 AC 31 ms
5,428 KB
testcase_19 AC 78 ms
5,136 KB
testcase_20 AC 173 ms
5,176 KB
testcase_21 AC 52 ms
5,244 KB
testcase_22 AC 218 ms
5,368 KB
testcase_23 AC 131 ms
5,176 KB
testcase_24 AC 29 ms
5,116 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

($h,$w,$k,$p)=glob<>;
@f=map[glob],<>;
for$i(0..(1<<$k)-1){
	if(unpack("%b*",pack(V,$i))==$p){
		my@a;
		$a[0][1]=1;
		$a[$f[$_][1]+1][$f[$_][0]+1]= ~$i&1<<$_ for 0..$k-1;
		for$y(0..$w){
			for$x(0..$h){
				$a[$y+1][$x+1]=
				$a[$y+1][$x+1]?0:
				$a[$y][$x+1]+$a[$y+1][$x];
			}
		}
		if($bv<$a[$w+1][$h+1]){
			$bv=$a[$w+1][$h+1];
			$bi=$i;
		}
	}
}
$,=$/;
print$bv%=1e9+7,map$f[$_][2],grep$bi&1<<$_,0..$k-1;
0