結果
問題 |
No.699 ペアでチームを作ろう2
|
ユーザー |
|
提出日時 | 2018-09-19 15:58:03 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,287 bytes |
コンパイル時間 | 495 ms |
コンパイル使用メモリ | 79,676 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-18 08:15:57 |
合計ジャッジ時間 | 1,134 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 3 WA * 9 |
ソースコード
#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]); }