結果

問題 No.519 アイドルユニット
ユーザー kotatsugamekotatsugame
提出日時 2020-03-12 00:26:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 655 ms / 1,000 ms
コード長 449 bytes
コンパイル時間 518 ms
コンパイル使用メモリ 67,060 KB
実行使用メモリ 68,992 KB
最終ジャッジ日時 2024-04-27 21:59:37
合計ジャッジ時間 6,176 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 634 ms
68,992 KB
testcase_01 AC 638 ms
68,864 KB
testcase_02 AC 152 ms
19,712 KB
testcase_03 AC 10 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 AC 4 ms
6,940 KB
testcase_11 AC 10 ms
6,940 KB
testcase_12 AC 2 ms
6,944 KB
testcase_13 AC 11 ms
6,940 KB
testcase_14 AC 11 ms
6,940 KB
testcase_15 AC 10 ms
6,940 KB
testcase_16 AC 10 ms
6,940 KB
testcase_17 AC 11 ms
6,944 KB
testcase_18 AC 11 ms
6,944 KB
testcase_19 AC 10 ms
6,940 KB
testcase_20 AC 10 ms
6,940 KB
testcase_21 AC 9 ms
6,944 KB
testcase_22 AC 11 ms
6,940 KB
testcase_23 AC 10 ms
6,940 KB
testcase_24 AC 36 ms
7,424 KB
testcase_25 AC 37 ms
7,424 KB
testcase_26 AC 37 ms
7,552 KB
testcase_27 AC 37 ms
7,552 KB
testcase_28 AC 37 ms
7,552 KB
testcase_29 AC 655 ms
68,864 KB
testcase_30 AC 646 ms
68,992 KB
testcase_31 AC 645 ms
68,992 KB
testcase_32 AC 644 ms
68,992 KB
testcase_33 AC 2 ms
6,940 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:7:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    7 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int N;
int F[24][24];
int dp[1<<24];
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)%2)continue;
		for(int j=0;j<N;j++)
		{
			if(i>>j&1)continue;
			for(int k=j+1;k<N;k++)
			{
				if(i>>k&1)continue;
				dp[i|1<<j|1<<k]=max(dp[i|1<<j|1<<k],dp[i]+F[j][k]);
			}
			break;
		}
	}
	cout<<dp[(1<<N)-1]<<endl;
}
0