結果

問題 No.334 門松ゲーム
ユーザー tailstails
提出日時 2016-01-15 22:46:18
言語 Perl
(5.38.0)
結果
AC  
実行時間 322 ms / 2,000 ms
コード長 293 bytes
コンパイル時間 429 ms
コンパイル使用メモリ 6,076 KB
実行使用メモリ 6,108 KB
最終ジャッジ日時 2023-10-19 23:25:40
合計ジャッジ時間 2,077 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 8 ms
6,100 KB
testcase_01 AC 8 ms
6,108 KB
testcase_02 AC 140 ms
6,100 KB
testcase_03 AC 7 ms
6,104 KB
testcase_04 AC 8 ms
6,108 KB
testcase_05 AC 8 ms
6,100 KB
testcase_06 AC 56 ms
6,104 KB
testcase_07 AC 73 ms
6,104 KB
testcase_08 AC 30 ms
6,104 KB
testcase_09 AC 29 ms
6,108 KB
testcase_10 AC 322 ms
6,104 KB
testcase_11 AC 26 ms
6,104 KB
testcase_12 AC 25 ms
6,108 KB
testcase_13 AC 22 ms
6,104 KB
testcase_14 AC 59 ms
6,104 KB
testcase_15 AC 63 ms
6,104 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$n=<>-1;
@k=glob<>;

sub f{
	my($u)=@_;
	for my$i(0..$n){
		for my$j($i+1..$n){
			for my$k($j+1..$n){
				if(($k[$i]-$k[$j])*($k[$j]-$k[$k])<0){
					my$v=1<<$i|1<<$j|1<<$k;
					if(($u&$v)==0){
						if(!f($u|$v)){
							return"$i $j $k";
						}
					}
				}
			}
		}
	}
}

print f()||-1;
0