Codeforces Round #428 (Div. 2)E. Mother of Dragons
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-;
const int N=+,maxn=+,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\n",u,pos,ans);
for(int i=u+;i<=n;i++)
{
printf("%d###%d\n",cnt[i],i);
if(cnt[i]+pos<=ans)return ;
if(a[u][i])
{
int j;
for(j=;j<pos;j++)if(!a[i][vis[j]])break;
printf("%d++++\n",j);
if(j==pos)
{
vis[pos]=i;
if(dfs(i,pos+))return ;
}
}
}
if(pos>ans)
{
for(int i=;i<pos;i++)group[i]=vis[i];
ans=pos;
return ;
}
return ;
}
void maxclique()
{
ans=-;
for(int i=n;i;i--)
{
vis[]=i;
dfs(i,);
cnt[i]=ans;
printf("%d!!!\n",cnt[i]);
}
}
int main()
{
int k;
scanf("%d%d",&n,&k);
for(int i=;i<=n;i++)
for(int j=;j<=n;j++)
scanf("%d",&a[i][j]);
maxclique();
// printf("%d\n",ans);
printf("%.12f\n",1.0*k/ans*k/ans*ans*(ans-)/);
return ;
}
/******************** ********************/
Codeforces Round #428 (Div. 2)E. Mother of Dragons的更多相关文章
- CodeForces 839C - Journey | Codeforces Round #428 (Div. 2)
起初误以为到每个叶子的概率一样于是.... /* CodeForces 839C - Journey [ DFS,期望 ] | Codeforces Round #428 (Div. 2) */ #i ...
- CodeForces 839D - Winter is here | Codeforces Round #428 (Div. 2)
赛后听 Forever97 讲的思路,强的一匹- - /* CodeForces 839D - Winter is here [ 数论,容斥 ] | Codeforces Round #428 (Di ...
- CodeForces 839B - Game of the Rows | Codeforces Round #428 (Div. 2)
血崩- - /* CodeForces 839B - Game of the Rows [ 贪心,分类讨论] | Codeforces Round #428 (Div. 2) 注意 2 7 2 2 2 ...
- Codeforces Round #428 (Div. 2) 题解
题目链接:http://codeforces.com/contest/839 A. Arya and Bran 题意:每天给你一点糖果,如果大于8个,就只能给8个,剩下的可以存起来,小于8个就可以全部 ...
- Codeforces Round #428 (Div. 2) D. Winter is here 容斥
D. Winter is here 题目连接: http://codeforces.com/contest/839/problem/D Description Winter is here at th ...
- 【Codeforces Round #428 (Div. 2) B】Game of the Rows
[Link]:http://codeforces.com/contest/839/problem/B [Description] 给你n排的如题目所示的位置; 同一排中(1,2) 算相邻; (3,4) ...
- 【Codeforces Round #428 (Div. 2) C】Journey
[Link]:http://codeforces.com/contest/839/problem/C [Description] 给一棵树,每当你到一个点x的时候,你进入x的另外一每一个出度的概率都是 ...
- Codeforces Round #428 (Div. 2)A,B,C
A. Arya and Bran time limit per test 1 second memory limit per test 256 megabytes input standard inp ...
- Codeforces Round #428 (Div. 2)
终于上蓝名了,hahahahaha,虽然这场的 B 题因为脑抽了,少考虑一种情况终判错了,还是很可惜的.. B题本来过来1500个人,终判之后只剩下了200多个,真的有毒!!!! A - Arya a ...
随机推荐
- MFC程序执行过程剖析
一 MFC程序执行过程剖析 1)我们知道在WIN32API程序当中,程序的入口为WinMain函数,在这个函数当中我们完成注册窗口类,创建窗口,进入消息循环,最后由操作系统根据发送到程序窗口的消息调用 ...
- k8s-离线安装coreos
1.安装准备 下载iso 前往页面https://coreos.com/os/docs/latest/booting-with-iso.html 版本:stable 1465.7.0 日期:2017. ...
- vue工程权限怎么配置?
vue工程权限怎么配置? router.beforeEach((to, from, next) => { }):方法的to参数能拿到router设置的对象信息,如: { path: " ...
- TabLayout与ViewPager同步后Tab的标题不显示
一.概述 1.1 问题描述 TabLayout+ViewPager后,TabLayout的TabItem不显示的问题: 1.2 截图 二.结论 mTabs.setupWithViewPager(mVi ...
- win下安装wget以及使用wget
1. 安装wget网址:http://gnuwin32.sourceforge.net/packages/wget.htm下载http://downloads.sourceforge.net/gnuw ...
- iOS 提升代码的安全性,可以做哪些措施???
希望能尽量防止别人 反编译你的代码: 目前苹果审核规则可知,苹果官方是不希望你使用代码混淆的...如果发现了你用代码混淆,甚至会勒令你修改你的代码,否则下一次审核会直接移除你的app…尤其是跑脚本的那 ...
- python3_configparser模块详解
主要介绍python3中的ConfigParser模块的使用,该模块主要被用来读写配置文件. 安装模块:pip3 install configparser root@ranxf:/usr/lib/py ...
- NRF24L01——工作原理解读
源: NRF24L01——工作原理解读
- bat调用exe文件并且传递参数
bat调用exe文件并且传递参数 bat调用exe,并且传递日期参数,代码: @echo off cd "E:\SublimeWorks\exe" start xyzj_shrjj ...
- Activiti:创建activiti工程
Activiti:创建activiti工程 一.Activiti下载: 1,Activiti下载地址:https://github.com/Activiti/Activiti/releases 2,A ...