結果
| 問題 | No.519 アイドルユニット |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-11-17 23:17:50 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 598 bytes |
| 記録 | |
| コンパイル時間 | 4,062 ms |
| コンパイル使用メモリ | 186,548 KB |
| 実行使用メモリ | 7,852 KB |
| 最終ジャッジ日時 | 2026-11-17 23:18:04 |
| 合計ジャッジ時間 | 10,999 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | TLE * 1 -- * 33 |
ソースコード
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;
int main(void){
int n; cin >> n;
vector a(n, vector<int>(n));
for(auto&x:a)for(auto&y:x) cin >> y;
int ans=0;
auto dfs=[&](auto dfs, int c, int mask, int now){
if(c==n){
ans=max(ans, now);
return;
}
for(int i=0; i<n; i++)if(!(mask>>i&1)){
int nm=mask|(1<<i);
for(int j=i+1; j<n; j++)if(!(mask>>j&1)){
dfs(dfs, c+2, (nm|(1<<j)), now+a[i][j]);
}
break;
}
return;
};
dfs(dfs, 0, 0, 0);
cout << ans << endl;
return 0;
}