結果

問題 No.519 アイドルユニット
ユーザー tailstails
提出日時 2017-05-28 22:24:17
言語 Perl
(5.38.2)
結果
WA  
実行時間 -
コード長 442 bytes
コンパイル時間 223 ms
コンパイル使用メモリ 5,460 KB
実行使用メモリ 5,656 KB
最終ジャッジ日時 2023-10-21 14:20:22
合計ジャッジ時間 1,415 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 5 ms
5,656 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 3 ms
5,600 KB
testcase_05 AC 3 ms
5,600 KB
testcase_06 AC 4 ms
5,600 KB
testcase_07 WA -
testcase_08 AC 4 ms
5,600 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 3 ms
5,596 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 4 ms
5,600 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.pl syntax OK

ソースコード

diff #

$n=<>;
for(0..$n-1){
	$f[$_]=[<>=~/\S+/g];
}

for$i(0..$n/2-1){
	$j=$i*2;
	$k=$i*2+1;
	$cd=$f[$j][$k];
	$ca=$k;
	$cb=$j;
	for$a(0..$j-1){
		for$b(0..$j-1){
			if($a-$b){
				$d=$f[$j][$a]+$f[$k][$b]-$f[$a][$l[$a]]-$f[$b][$l[$b]]+$f[$l[$a]][$l[$b]];
				if($cd<$d){
					$cd=$d;
					$ca=$a;
					$cb=$b;
				}
			}
		}
	}
	$s+=$cd;
	$la=$l[$a]; $lb=$l[$b]; $l[$a]=$lb; $l[$b]=$la;
	$l[$j]=$ca; $l[$ca]=$j;
	$l[$k]=$cb; $l[$cb]=$k;
}
print$s;
0