結果

問題 No.2675 KUMA
ユーザー tailstails
提出日時 2024-03-18 17:21:46
言語 Perl
(5.38.2)
結果
AC  
実行時間 1,103 ms / 2,000 ms
コード長 463 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 6,548 KB
実行使用メモリ 12,800 KB
最終ジャッジ日時 2024-03-18 17:21:57
合計ジャッジ時間 10,502 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,676 KB
testcase_01 AC 11 ms
6,676 KB
testcase_02 AC 8 ms
6,676 KB
testcase_03 AC 7 ms
6,676 KB
testcase_04 AC 7 ms
6,676 KB
testcase_05 AC 664 ms
12,800 KB
testcase_06 AC 534 ms
12,800 KB
testcase_07 AC 8 ms
6,676 KB
testcase_08 AC 725 ms
12,800 KB
testcase_09 AC 334 ms
9,344 KB
testcase_10 AC 831 ms
12,800 KB
testcase_11 AC 833 ms
12,800 KB
testcase_12 AC 244 ms
7,680 KB
testcase_13 AC 9 ms
6,676 KB
testcase_14 AC 18 ms
6,676 KB
testcase_15 AC 8 ms
6,676 KB
testcase_16 AC 1,103 ms
12,800 KB
testcase_17 AC 7 ms
6,676 KB
testcase_18 AC 7 ms
6,676 KB
testcase_19 AC 8 ms
6,676 KB
testcase_20 AC 7 ms
6,676 KB
testcase_21 AC 8 ms
6,676 KB
testcase_22 AC 7 ms
6,676 KB
testcase_23 AC 8 ms
6,676 KB
testcase_24 AC 8 ms
6,676 KB
testcase_25 AC 8 ms
6,676 KB
testcase_26 AC 8 ms
6,676 KB
testcase_27 AC 9 ms
6,676 KB
testcase_28 AC 9 ms
6,676 KB
testcase_29 AC 8 ms
6,676 KB
testcase_30 AC 10 ms
6,676 KB
testcase_31 AC 17 ms
6,676 KB
testcase_32 AC 18 ms
6,676 KB
testcase_33 AC 17 ms
6,676 KB
testcase_34 AC 18 ms
6,676 KB
testcase_35 AC 29 ms
6,676 KB
testcase_36 AC 52 ms
6,676 KB
testcase_37 AC 52 ms
6,676 KB
testcase_38 AC 101 ms
6,912 KB
testcase_39 AC 93 ms
6,912 KB
testcase_40 AC 103 ms
6,912 KB
testcase_41 AC 204 ms
7,680 KB
testcase_42 AC 214 ms
7,680 KB
testcase_43 AC 209 ms
7,680 KB
testcase_44 AC 210 ms
7,680 KB
testcase_45 AC 415 ms
9,344 KB
testcase_46 AC 433 ms
9,344 KB
testcase_47 AC 460 ms
9,344 KB
testcase_48 AC 805 ms
12,800 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$;=$";
@d=(-2,-2,-1,+1,+2,+2,+1,-1);
$n=<>;
for(0..$n-1){
	($x,$y)=glob<>;
	$p{$x,$y}=1<<$_;
	for$j(0..7){
		$k{$x-$d[$j+6&7],$y-$d[$j]}=1;
	}
}
@b=(0,(17)x((1<<$n)-1));
for(keys%k){
	if(!$p{$_}){
		@a=@b;
		($x,$y)=glob;
		for$j(0,2,4,6){
			$p=0;
			for(0,1){
				$p|=$p{$x+$d[$j+6&7^$_],$y+$d[$j^$_]};
			}
			if($p){
				for(0..(1<<$n)-1){
					if($b[$_|$p]>$a[$_]+1){
						$b[$_|$p]=$a[$_]+1;
					}
				}
			}
		}
	}
}
print $_<17?$_:-1 for $b[(1<<$n)-1];
0