結果
問題 |
No.698 ペアでチームを作ろう
|
ユーザー |
|
提出日時 | 2018-09-19 15:44:17 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,320 bytes |
コンパイル時間 | 555 ms |
コンパイル使用メモリ | 78,056 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-18 08:15:47 |
合計ジャッジ時間 | 1,114 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 3 |
other | AC * 1 WA * 11 |
ソースコード
#include <iostream> #include <cmath> #include <string> #include <algorithm> #include <set> #include <vector> #include <map> #include <list> #include <stack> #include <cstdio> #include <cstring> #include <cstdlib> #include <queue> #define pye cout << "yes" << endl; #define pno cout << "no" << endl; #define pYe cout << "Yes" << endl; #define pNo cout << "No" << endl; #define pYE cout << "YES" << endl; #define pNO cout << "NO" << endl; #define prin(num) cout << num << endl; #define max(a, b) ((a)>(b) ? (a):(b)) #define min(a, b) ((a)<(b) ? (a):(b)) #define INF 100000000000 #define MOD 1000000007LL #define MAX_V 10005 #define MAX_E 30005 #define NIL -1 #define WHITE 0 #define BLACK 1 #define mp make_pair using namespace std; typedef long long ll; typedef pair<ll, ll> P; typedef map<ll, ll> Map; int main(void) { ll N, i; cin >> N; ll A[14]; ll dp[1<<14]={0}; ll msk; ll a, b; for(i=0; i<N; i++) { cin >> A[i]; } for(msk=0; msk<1<<N; msk++) { for(a=0; a<N; a++) { for(b=a+1; b<N; b++) { if(!(msk>>a&1) && !(msk>>b&1)) { dp[msk || (1<<a) || (1<<b)]= max(dp[msk || (1<<a) || (1<<b)], dp[msk]+(A[a]^A[b])); } } } } prin(dp[(1<<N)-1]); }