結果
| 問題 |
No.698 ペアでチームを作ろう
|
| ユーザー |
|
| 提出日時 | 2025-06-30 17:31:14 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 9 ms / 1,000 ms |
| コード長 | 431 bytes |
| コンパイル時間 | 1,966 ms |
| コンパイル使用メモリ | 194,744 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-06-30 17:31:18 |
| 合計ジャッジ時間 | 3,070 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
int N,A[14];
long dp[1<<14];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin>>N;
for(int i=0;i<N;i++)cin>>A[i];
for(int i=0;i<1<<N;i++){
for(int j=0;j<N;j++)if(!(i>>j&1)){
for(int k=0;k<N;k++)if(j!=k&&!(i>>k&1)){
int ni=i|1<<j|1<<k;
dp[ni]=max(dp[ni],dp[i]+(A[j]^A[k]));
}
}
}
cout<<dp[(1<<N)-1]<<'\n';
return 0;
}