結果
| 問題 |
No.698 ペアでチームを作ろう
|
| ユーザー |
Tttt Yay
|
| 提出日時 | 2020-11-19 23:52:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 561 bytes |
| コンパイル時間 | 1,060 ms |
| コンパイル使用メモリ | 90,740 KB |
| 最終ジャッジ日時 | 2024-07-23 11:52:50 |
| 合計ジャッジ時間 | 1,696 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:9:9: error: 'cin' was not declared in this scope
9 | int n;cin>>n;
| ^~~
main.cpp:2:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
1 | #include <atcoder/all>
+++ |+#include <iostream>
2 | #define rep(i, n) for (int i = 0; i < (n); i++)
main.cpp:25:3: error: 'cout' was not declared in this scope
25 | cout<<dp[n2-1]<<endl;
| ^~~~
main.cpp:25:3: note: 'std::cout' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
main.cpp:25:19: error: 'endl' was not declared in this scope
25 | cout<<dp[n2-1]<<endl;
| ^~~~
main.cpp:2:1: note: 'std::endl' is defined in header '<ostream>'; did you forget to '#include <ostream>'?
1 | #include <atcoder/all>
+++ |+#include <ostream>
2 | #define rep(i, n) for (int i = 0; i < (n); i++)
ソースコード
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using namespace std;
using namespace atcoder;
const int mod = 1000000007;
const int INF =1e9+1;
int main(){
int n;cin>>n;
vector<int> a(n);
rep(i,n)cin>>a[i];
int n2=1<<n;
vector<int> dp(n2);
rep(i,n2){
rep(j,n){
if(i>>j&1)continue;
for(int k=j+1;k<n;k++){
if(i>>k&1)continue;
int x=1<<j|1<<k;
x=i|x;
dp[i|(1<<j)|(1<<k)]=max(dp[i|(1<<j)|(1<<k)],dp[i]+(a[j]^a[k]));
}
}
}
cout<<dp[n2-1]<<endl;
}
Tttt Yay