結果

問題 No.699 ペアでチームを作ろう2
ユーザー Kutimoti_TKutimoti_T
提出日時 2018-06-21 16:55:24
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 662 bytes
コンパイル時間 1,155 ms
コンパイル使用メモリ 146,624 KB
実行使用メモリ 9,008 KB
最終ジャッジ日時 2023-09-13 07:34:31
合計ジャッジ時間 3,988 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,596 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 315 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define i64 long long
#define rep(i,s,e) for(int (i) = (s);(i) <= (e);(i)++)

int N;
vector<i64> A;
i64 ans = 0;
int rec(int bit,i64 XOR){
    if(bit == (1 << N) - 1){
        ans = max(ans , XOR);
        return 0;
    }
    for(int i = 0;i < N;i++){
        for(int j = 0;j < N;j++){
            if(i == j) continue;
            if((bit & (1<< i))) continue;
            if((bit & (1<< j))) continue;
            rec(bit | (1 << i) | (1 << j) , XOR ^ (A[i] + A[j]));
        }
    }
    return 0;
}
int main(){
    cin >> N;
    A.resize(N);
    rep(i,0,N - 1) cin >> A[i];
    rec(0,0);
    cout << ans << endl;
}
0