結果
問題 |
No.519 アイドルユニット
|
ユーザー |
![]() |
提出日時 | 2025-03-15 16:49:46 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,323 bytes |
コンパイル時間 | 1,777 ms |
コンパイル使用メモリ | 161,220 KB |
実行使用メモリ | 7,328 KB |
最終ジャッジ日時 | 2025-03-15 16:49:49 |
合計ジャッジ時間 | 2,893 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | WA * 34 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:51:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 51 | freopen("group.in","r",stdin); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~ main.cpp:52:16: warning: ignoring return value of ‘FILE* freopen(const char*, const char*, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 52 | freopen("group.out","w",stdout); | ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long #define bui __builtin_popcount #define pii pair<int,int> #define se second #define fi first #define mid (l+r>>1) #define qwq cout<<"----------------------------------------------------------------------"; const int inf=1e18; int read(){ int x=0,f=1;char ch=getchar(); while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();} while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();} return x*f; } void prt(int x){ if(x<0)putchar('-'),x=-x; if(x<10)putchar(x+'0'); else prt(x/10),putchar(x%10+'0'); } int ksm(int x,int y,int mod){ if(y==0)return 1; int k=ksm(x,y/2ll,mod); if(y&1ll)return k*k%mod*x%mod; return k*k%mod; } const int N=1e6+5; int gcd(int x,int y){return (y)?gcd(y,x%y):x;} int max(int x,int y){return (x>y)?x:y;} int min(int x,int y){return (x<y)?x:y;} int n,cnt,a[25][25],f[(1<<24)],b[25]; void sl(){ cin>>n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++)a[i][j]=read(); } for(int i=3;i<(1<<n);i++){ if(bui(i)&1)continue; cnt=0; for(int j=0;j<n;j++){ if((1<<j)&i)b[++cnt]=j; } for(int j=2;j<=cnt;j++){ f[i]=max(f[i-(1<<b[1])-(1<<b[j])]+a[b[1]][b[j]],f[i]); } } cout<<f[(1<<n)-1]; } signed main(){ freopen("group.in","r",stdin); freopen("group.out","w",stdout); int t=1; // cin>>t; while(t--)sl(); return 0; }