結果
| 問題 |
No.699 ペアでチームを作ろう2
|
| ユーザー |
treeone
|
| 提出日時 | 2018-08-02 23:32:24 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 653 bytes |
| コンパイル時間 | 1,444 ms |
| コンパイル使用メモリ | 168,892 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-19 17:14:34 |
| 合計ジャッジ時間 | 2,036 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | WA * 12 |
ソースコード
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define int long long
#define chmax(x, y) x = max(x, y)
using namespace std;
typedef pair<int, int> P;
const int INF = 1e15;
int dp[1LL << 14];
signed main(){
int n;
cin >> n;
vector<int> a(n);
rep(i, 0, n) cin >> a[i];
for(int mask = 0; mask < (1LL << n); mask++){
rep(i, 0, n){
rep(j, i + 1, n){
if(!(mask & (1LL << i)) && !(mask &(1LL << j))){
chmax(dp[mask + (1LL << i) + (1LL << j)], dp[mask] + (a[i]^a[j]));
}
}
}
}
cout << dp[(1LL << n) - 1] << endl;
}
treeone