http://codeforces.com/contest/839/problem/E
最大团裸题= =,用Bron–Kerbosch算法,复杂度大多博客上没有,维基上查了查大约是O(3n/3)
最大团: V中取K个顶点,两点间相互连接
最大独立集: V中取K个顶点,两点间不连接
最大团数量 = 补图中最大独立集数
//#pragma comment(linker, "/stack:200000000") //#pragma GCC optimize("Ofast,no-stack-protector") //#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native") //#pragma GCC optimize("unroll-loops") #include<bits/stdc++.h> #define fi first #define se second #define mp make_pair #define pb push_back #define pi acos(-1.0) #define ll long long #define mod 1000000007 #define C 0.5772156649 #define ls l,m,rt<<1 #define rs m+1,r,rt<<1|1 #define pil pair<int,ll> #define pii pair<int,int> #define cd complex<double> #define ull unsigned long long //#define base 1000000000000000000 #define fio ios::sync_with_stdio(false);cin.tie(0) using namespace std; const double g=10.0,eps=1e-12; const int N=50+10,maxn=1200000+10,inf=0x3f3f3f3f,INF=0x3f3f3f3f3f3f3f3f; int ans,cnt[N],group[N],vis[N]; int n,a[N][N]; bool dfs(int u,int pos) { printf("%d---%d----%d ",u,pos,ans); for(int i=u+1;i<=n;i++) { printf("%d###%d ",cnt[i],i); if(cnt[i]+pos<=ans)return 0; if(a[u][i]) { int j; for(j=0;j<pos;j++)if(!a[i][vis[j]])break; printf("%d++++ ",j); if(j==pos) { vis[pos]=i; if(dfs(i,pos+1))return 1; } } } if(pos>ans) { for(int i=0;i<pos;i++)group[i]=vis[i]; ans=pos; return 1; } return 0; } void maxclique() { ans=-1; for(int i=n;i;i--) { vis[0]=i; dfs(i,1); cnt[i]=ans; printf("%d!!! ",cnt[i]); } } int main() { int k; scanf("%d%d",&n,&k); for(int i=1;i<=n;i++) for(int j=1;j<=n;j++) scanf("%d",&a[i][j]); maxclique(); // printf("%d ",ans); printf("%.12f ",1.0*k/ans*k/ans*ans*(ans-1)/2); return 0; } /******************** ********************/