結果
| 問題 |
No.699 ペアでチームを作ろう2
|
| ユーザー |
|
| 提出日時 | 2018-09-28 10:53:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 340 ms / 1,000 ms |
| コード長 | 546 bytes |
| コンパイル時間 | 1,685 ms |
| コンパイル使用メモリ | 172,372 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 04:46:19 |
| 合計ジャッジ時間 | 4,738 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n;
cin >> n;
vector<ll> a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
sort(a.begin(), a.end());
ll ans = 0;
do {
ll s = 0;
for (int i = 0; i < n / 2; i++) s ^= (a[i] + a[i + n / 2]);
ans = max(ans, s);
reverse(a.begin() + n / 2, a.end());
} while (next_permutation(a.begin(), a.end()));
cout << ans << endl;
return 0;
}