結果
| 問題 |
No.519 アイドルユニット
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-11-08 19:33:46 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 853 bytes |
| コンパイル時間 | 4,867 ms |
| コンパイル使用メモリ | 298,240 KB |
| 最終ジャッジ日時 | 2025-03-13 06:00:51 |
| 合計ジャッジ時間 | 5,684 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
In file included from /usr/include/c++/13/string:43,
from /usr/include/c++/13/bitset:52,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
from main.cpp:4:
/usr/include/c++/13/bits/allocator.h: In destructor ‘constexpr std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()’:
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to ‘always_inline’ ‘constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]’: target specific option mismatch
184 | ~allocator() _GLIBCXX_NOTHROW { }
| ^
In file included from /usr/include/c++/13/vector:66,
from /usr/include/c++/13/functional:64,
from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
133 | struct _Vector_impl
| ^~~~~~~~~~~~
ソースコード
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
// #include<atcoder/scc>
using namespace std;
// using namespace atcoder;
void chmax(int &a, int b){
if(a < b) a = b;
}
void solve(){
int n;
cin >> n;
vector<vector<int>> F(n, vector<int>(n));
for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) cin >> F[i][j];
vector<int> dp(1 << n, -1);
dp[0] = 0;
for(int bit = 0; bit < (1 << n) - 1; bit++){
if(dp[bit] < 0) continue;
for(int i = 0; i < n; i++){
if(bit >> i & 1) continue;
for(int j = i + 1; j < n; j++){
if(bit >> j & 1) continue;
chmax(dp[bit | (1 << i) | (1 << j)], dp[bit] + F[i][j]);
}
break;
}
}
cout << dp[(1 << n) - 1] << "\n";
}
int main(){
cin.tie(0)->sync_with_stdio(0);
int t;
t = 1;
// cin >> t;
while(t--) solve();
}