結果

問題 No.699 ペアでチームを作ろう2
ユーザー Rumain831
提出日時 2026-11-03 04:00:01
言語 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
結果
AC  
実行時間 4 ms / 1,000 ms
+ 336µs
コード長 614 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,365 ms
コンパイル使用メモリ 181,924 KB
実行使用メモリ 9,812 KB
最終ジャッジ日時 2026-11-03 04:00:06
合計ジャッジ時間 4,179 ms
ジャッジサーバーID
(参考情報)
judge7_0 / judge4_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 13
権限があれば一括ダウンロードができます

ソースコード

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<int> a(n), used(n);
  for(auto&x:a) cin >> x;
  int ans=0, m=n/2;
  auto dfs=[&](auto dfs, int step, int now)->void {
    if(step==m){
      ans=max(ans, now);
      return;
    }
    for(int i=0; i<n; i++)if(used[i]==0){
      used[i]=1;
      for(int j=i+1; j<n; j++)if(used[j]==0){
        used[j]=1;
        dfs(dfs, step+1, now^(a[i]+a[j]));
        used[j]=0;
      }
      used[i]=0;
      break;
    }
  };
  dfs(dfs, 0, 0);
  cout << ans << endl;
  return 0; 
}
0