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 ...
随机推荐
- STL: fill,fill_n,generate,generate_n
fill Assigns the same new value to every element in a specified range. template<class ForwardIter ...
- gdb core
程序运行发生异常退出,比如segment错误,此时可以利用系统生成的core文件,配合GDB来定位问题. 问题程序: segment.c #include <stdio.h> #inclu ...
- [Windows Powershell]-学习笔记(5)
Powershell自动化变量 Powershell 自动化变量 是那些一旦打开Powershell就会自动加载的变量,或者说是运行是变量. 这些变量一般存放的内容包括 用户信息:例如用户的根目录$h ...
- 什么是阻塞式和非阻塞io流?
阻塞IO:socket 的阻塞模式意味着必须要做完IO 操作(包括错误)才会返回. 非阻塞IO:非阻塞模式下无论操作是否完成都会立刻返回,需要通过其他方式来判断具体操作是否成功. 两者区别: 所谓阻塞 ...
- 在Ubuntu14.4(32位)中配置I.MX6的QT编译环境
1,开发工具下载 一,下载VMware Workstation虚拟机 地址:http://1.xp510.com:801/xp2011/VMware10.7z 二,下载Ubuntu 14.04.5 L ...
- git服务器-------》用户免密git操作
找到/etc/ssh/sshd_config文件 开启 RSAAuthentication yesPubkeyAuthentication yesAuthorizedKeysFile .ss ...
- PHP秒杀系统全方位设计分析(一)
秒杀系统特点人多商品少时间短流量高外挂机器[黄牛和非黄牛] 技术分析瞬间高并发的处理能力多层次的分布式处理能力人机交互与对抗[12306验证码图片] 技术选型分析Linux+Nginx+PHP+Mys ...
- Vue组件里面data为什么必须是个函数
在创建或注册模板的时候,传入一个data属性用来绑定数据,但是在组件中,data必须是一个函数,而不能直接把对象赋值给它. export default { name:'app', data(){ r ...
- windows server 2012泛域名解析配置
应测试要求,要将一个泛域名(*.office.baibai.com)解析到一个内网的IP(10.1.100.240)地址上(使用域控DNS解析)...以下为我的配置过程,做的时候将图顺便接了下来: 1 ...
- nmap与Nessus扫描特定靶机分析
打开装载Metasploitable2虚拟机的靶机,并获取靶机ip: 使用nmap+ip初步扫描靶机 PORT为端口,STATE为端口开放状态,SERVICE为端口的提供的服务.靶机的MAC地址为: ...