結果
問題 |
No.519 アイドルユニット
|
ユーザー |
![]() |
提出日時 | 2025-03-14 15:57:04 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 790 ms / 1,000 ms |
コード長 | 739 bytes |
コンパイル時間 | 4,063 ms |
コンパイル使用メモリ | 274,640 KB |
実行使用メモリ | 68,992 KB |
最終ジャッジ日時 | 2025-03-14 15:57:16 |
合計ジャッジ時間 | 10,566 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 34 |
ソースコード
// Problem:No.519 ???????? // Contest:yukicoder // URL:https://yukicoder.me/problems/no/519 // Memory Limit:512 MB // Time Limit:1000 ms // Codeforces/Luogu Account:Butterfly_qwq // Atcoder Account:Super_agg // CP Duel Rating:2034 // Start Coding:03-14 14:35 // // Powered by CP Editor (https://cpeditor.org) #include<bits/stdc++.h> using namespace std; int n,ans,f[24][24],dp[1<<24]; int main() { cin>>n; for(int i=0;i<n;i++)for(int j=0;j<n;j++)cin>>f[i][j]; for(int i=0,pd;i<(1<<n);i++) { if(__builtin_popcount(i)&1)continue; for(int j=0;j<n;j++)if(~i&(1<<j)) { for(int k=j+1;k<n;k++)if(~i&(1<<k)) { pd=i|(1<<j)|(1<<k); dp[pd]=max(dp[pd],dp[i]+f[j][k]); } break; } ans=max(ans,dp[i]); } cout<<ans; }