結果

問題 No.519 アイドルユニット
ユーザー vjudge1
提出日時 2025-03-14 15:52:21
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 678 bytes
コンパイル時間 3,292 ms
コンパイル使用メモリ 273,040 KB
実行使用メモリ 38,592 KB
最終ジャッジ日時 2025-03-14 15:52:30
合計ジャッジ時間 8,032 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

// Problem:No.519 ????????
// Contest:yukicoder
// URL:https://yukicoder.me/problems/no/519
// Memory Limit:512 MB
// Time Limit:1000 ms
// Codeforces/Luogu Account:Butterfly_qwq
// Atcoder Account:Super_agg
// CP Duel Rating:2034
// Start Coding:03-14 14:35
// 
// Powered by CP Editor (https://cpeditor.org)

#include<bits/stdc++.h>
using namespace std;
int n,ans,f[24][24],dp[1<<24];
int main()
{
	cin>>n;
	for(int i=0;i<n;i++)for(int j=0;j<n;j++)cin>>f[i][j];
	for(int i=0;i<(1<<n);i++)
	{
		if(__builtin_popcount(i)&1)continue;
		for(int j=0;j<n;j++)for(int k=0;k<j;k++)if((i>>j)&(i>>k)&1)dp[i]=max(dp[i],dp[i^(1<<j)^(1<<k)]+f[j][k]);
		ans=max(ans,dp[i]);
	}
	cout<<ans;
}
0