結果
問題 |
No.699 ペアでチームを作ろう2
|
ユーザー |
![]() |
提出日時 | 2018-06-15 14:05:23 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 610 bytes |
コンパイル時間 | 1,513 ms |
コンパイル使用メモリ | 160,656 KB |
実行使用メモリ | 13,760 KB |
最終ジャッジ日時 | 2024-06-30 14:47:24 |
合計ジャッジ時間 | 4,382 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 1 TLE * 1 -- * 10 |
ソースコード
#include<bits/stdc++.h> #define INF 1e9 #define llINF 1e18 #define MOD 1e9+7 #define pb push_back #define mp make_pair #define F first #define S second #define ll long long using namespace std; int n; vector<ll>vll(50); ll dfs(int used,ll sum,ll ma){ if(used==((1<<n)-1)){ return ma=max(ma,sum); } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if((i==j)||(used&(1<<i))||(used&(1<<j))) continue; ma=max(dfs((used+(1<<i)+(1<<j)),sum^(vll[i]+vll[j]),ma),ma); } } return ma; } int main(){ cin>>n; for(int i=0;i<n;i++) cin>>vll[i]; cout<<dfs(0,0,0)<<endl; return 0; }