結果
| 問題 | No.698 ペアでチームを作ろう |
| ユーザー |
mine691
|
| 提出日時 | 2020-01-17 18:04:12 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 7 ms / 1,000 ms |
| コード長 | 848 bytes |
| 記録 | |
| コンパイル時間 | 1,755 ms |
| コンパイル使用メモリ | 170,068 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-25 15:55:06 |
| 合計ジャッジ時間 | 2,436 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;
const int inf = (1 << 30) - 1;
const ll infll = (1LL << 61) - 1;
#define fast() ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define digit(N) cout << fixed << setprecision((N))
int N;
int main()
{
cin >> N;
vector<int> dp(1 << N), a(N);
for (int i = 0; i < N; i++)
{
cin >> a[i];
}
for (int bit = 0; bit < (1 << N); bit++)
{
for (int i = 0; i < N; i++)
{
for (int j = i + 1; j < N; j++)
{
if (!(bit & (1 << i)) && !(bit & (1 << j)))
{
dp[bit + (1 << i) + (1 << j)] = max(dp[bit + (1 << i) + (1 << j)], dp[bit] + (a[i] ^ a[j]));
}
}
}
}
cout << dp[(1 << N) - 1] << "\n";
}
mine691