結果
問題 |
No.699 ペアでチームを作ろう2
|
ユーザー |
|
提出日時 | 2018-09-04 13:39:36 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 552 bytes |
コンパイル時間 | 591 ms |
コンパイル使用メモリ | 63,872 KB |
実行使用メモリ | 10,496 KB |
最終ジャッジ日時 | 2024-10-13 08:36:54 |
合計ジャッジ時間 | 3,803 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 2 TLE * 1 -- * 9 |
ソースコード
#include<iostream> using namespace std; int n, ans = 0, a[14] = {}; void dfs(int score, int bitset){ if(bitset == (1<<n)-1){ ans = max(ans, score); return; } for(int i = 0; i < n; i++){ if(~bitset & 1<<i){ for(int j = i+1; j < n; j++){ if(~bitset & 1<<j){ dfs(score ^ (a[i] + a[j]), bitset|1<<i|1<<j); } } } } } int main(){ cin >> n; for(int i = 0; i < n; i++) cin >> a[i]; dfs(0, 0); cout << ans << endl; }