結果
| 問題 | No.699 ペアでチームを作ろう2 |
| ユーザー |
|
| 提出日時 | 2026-11-03 04:00:01 |
| 言語 | C++23(gcc16) (gcc 16.2.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 4 ms / 1,000 ms |
| + 336µs | |
| コード長 | 614 bytes |
| 記録 | |
| コンパイル時間 | 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 |
ソースコード
#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;
}