結果

問題 No.519 アイドルユニット
ユーザー chocoruskchocorusk
提出日時 2018-12-21 15:42:29
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 942 bytes
コンパイル時間 1,384 ms
コンパイル使用メモリ 97,268 KB
実行使用メモリ 69,040 KB
最終ジャッジ日時 2023-10-26 01:29:13
合計ジャッジ時間 15,372 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 AC 452 ms
68,996 KB
testcase_03 AC 74 ms
68,996 KB
testcase_04 AC 53 ms
68,996 KB
testcase_05 AC 55 ms
68,996 KB
testcase_06 AC 56 ms
68,996 KB
testcase_07 AC 55 ms
68,996 KB
testcase_08 AC 55 ms
68,996 KB
testcase_09 AC 57 ms
68,996 KB
testcase_10 AC 59 ms
68,996 KB
testcase_11 AC 75 ms
68,996 KB
testcase_12 AC 55 ms
68,996 KB
testcase_13 AC 74 ms
68,996 KB
testcase_14 AC 74 ms
68,996 KB
testcase_15 AC 74 ms
68,996 KB
testcase_16 AC 75 ms
68,996 KB
testcase_17 AC 74 ms
68,996 KB
testcase_18 AC 75 ms
68,996 KB
testcase_19 AC 76 ms
68,996 KB
testcase_20 AC 74 ms
68,996 KB
testcase_21 AC 75 ms
68,996 KB
testcase_22 AC 76 ms
68,996 KB
testcase_23 AC 76 ms
68,996 KB
testcase_24 AC 119 ms
68,996 KB
testcase_25 AC 117 ms
68,996 KB
testcase_26 AC 115 ms
68,996 KB
testcase_27 AC 116 ms
68,996 KB
testcase_28 AC 117 ms
68,996 KB
testcase_29 TLE -
testcase_30 TLE -
testcase_31 TLE -
testcase_32 TLE -
testcase_33 AC 55 ms
68,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n;
	cin>>n;
	int f[24][24];
	for(int i=0; i<n; i++){
		for(int j=0; j<n; j++){
			cin>>f[i][j];
		}
	}
	int dp[1<<24]={};
	for(int i=0; i<(1<<n); i++){
	    int c=__builtin_popcount(i);
		if(c>=n/2) continue;
		if(c&1) continue;
		for(int j=0; j<n; j++){
			if(i&(1<<j)) continue;
			for(int k=j+1; k<n; k++){
				if(i&(1<<k)) continue;
				dp[(i|(1<<j))|(1<<k)]=max(dp[(i|(1<<j))|(1<<k)], dp[i]+f[j][k]);
			}
		}
	}
	int ans=0;
	for(int i=0; i<(1<<n); i++){
		ans=max(ans, dp[i]+dp[(1<<n)-1-i]);
	}
	cout<<ans<<endl;
	return 0;
}
0