結果
問題 |
No.699 ペアでチームを作ろう2
|
ユーザー |
|
提出日時 | 2019-08-26 19:17:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 9 ms / 1,000 ms |
コード長 | 1,129 bytes |
コンパイル時間 | 1,290 ms |
コンパイル使用メモリ | 101,984 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-15 19:12:09 |
合計ジャッジ時間 | 1,932 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
#include <limits> #include <iostream> #include <algorithm> #include <iomanip> #include <map> #include <set> #include <queue> #include <stack> #include <numeric> #include <bitset> #include <cmath> static const int MOD = 1000000007; using ll = long long; using u32 = uint32_t; using namespace std; template<class T> constexpr T INF = ::numeric_limits<T>::max()/32*15+208; void solve(int val, int x, vector<int> &state){ } int main() { int n; cin >> n; vector<int> v(n), ans; for (auto &&i : v) scanf("%d", &i); vector<int> state(n); auto rec = [&](auto &&f, int val, int cur, vector<int> &state) -> void { while(cur < n && state[cur] == 1) cur++; if(cur == n) { ans.emplace_back(val); return; } state[cur] = 1; for (int i = cur+1; i < n; ++i) { if(state[i]) continue; state[i] = 1; f(f, val^(v[cur]+v[i]), cur+1+(i == cur+1), state); state[i] = 0; } state[cur] = 0; }; rec(rec, 0, 0, state); cout << *max_element(ans.begin(),ans.end()) << "\n"; return 0; }