結果

問題 No.519 アイドルユニット
コンテスト
ユーザー Rumain831
提出日時 2026-11-17 23:17:50
言語 C++23(gcc16)
(gcc 16.2.0 + boost 1.92.0 + ACL)
コンパイル:
g++-16 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc16.so -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 598 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 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
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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; 
}
0