結果
| 問題 | 
                            No.699 ペアでチームを作ろう2
                             | 
                    
| ユーザー | 
                             Kutimoti_T
                         | 
                    
| 提出日時 | 2018-06-21 16:55:24 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 662 bytes | 
| コンパイル時間 | 1,676 ms | 
| コンパイル使用メモリ | 161,124 KB | 
| 実行使用メモリ | 13,756 KB | 
| 最終ジャッジ日時 | 2024-06-30 17:37:02 | 
| 合計ジャッジ時間 | 4,143 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 1 TLE * 1 -- * 10 | 
ソースコード
#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;
}
            
            
            
        
            
Kutimoti_T