結果

問題 No.699 ペアでチームを作ろう2
ユーザー finefine
提出日時 2018-09-28 10:46:20
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 661 bytes
コンパイル時間 1,374 ms
コンパイル使用メモリ 168,800 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-12 04:46:14
合計ジャッジ時間 1,941 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 3 WA * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

using ll = long long;

ll dp[1 << 14];

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];
    }

    for (int i = 0; i + 1 < (1 << n); i++) {
        for (int j = 0; j < n; j++) {
            if (i & (1 << j)) continue;
            for (int k = j + 1; k < n; k++) {
                if (i & (1 << k)) continue;
                dp[(i | (1 << j)) | (1 << k)] = max(dp[(i | (1 << j)) | (1 << k)], dp[i] ^ (a[j] + a[k]));
            }
        }
    }
    cout << dp[(1 << n) - 1] << endl;
    return 0;
}
0