cf987f AND Graph
#include <iostream>
#include <cstdio>
using namespace std;
int n, uu, m;
bool a[4500005], vis[4500005][2];
void dfs(int x, int y){
if(vis[x][y]) return ;
vis[x][y] = true;
if(y==1) dfs(x, 2);
else{
for(int i=0; i<n; i++)
if(!(x&(1<<i)))
dfs(x|(1<<i), 2);
if(a[(1<<n)-1-x]) dfs((1<<n)-1-x, 1);
}
}
int main(){
cin>>n>>m;
for(int i=1; i<=m; i++){
scanf("%d", &uu);
a[uu] = true;
}
int ans=0;
for(int i=0; i<(1<<n); i++)
if(a[i] && !vis[i][1]){
dfs(i, 1);
ans++;
}
cout<<ans<<endl;
return 0;
}
cf987f AND Graph的更多相关文章
- [开发笔记] Graph Databases on developing
TimeWall is a graph databases github It be used to apply mathematic model and social network with gr ...
- Introduction to graph theory 图论/脑网络基础
Source: Connected Brain Figure above: Bullmore E, Sporns O. Complex brain networks: graph theoretica ...
- POJ 2125 Destroying the Graph 二分图最小点权覆盖
Destroying The Graph Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 8198 Accepted: 2 ...
- [LeetCode] Number of Connected Components in an Undirected Graph 无向图中的连通区域的个数
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...
- [LeetCode] Graph Valid Tree 图验证树
Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), ...
- [LeetCode] Clone Graph 无向图的复制
Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's ...
- 讲座:Influence maximization on big social graph
Influence maximization on big social graph Fanju PPT链接: social influence booming of online social ne ...
- zabbix利用api批量添加item,并且批量配置添加graph
关于zabbix的API见,zabbixAPI 1item批量添加 我是根据我这边的具体情况来做的,本来想在模板里面添加item,但是看了看API不支持,只是支持在host里面添加,所以我先在一个ho ...
- Theano Graph Structure
Graph Structure Graph Definition theano's symbolic mathematical computation, which is composed of: A ...
随机推荐
- html css:背景图片链接css写法
图片作为背景,并且是链接的写法.例如网站的logo图片.例如:土豆的logo图片 <a title="土豆网 tudou.com 每个人都是生活的导演" href=" ...
- Android(java)学习笔记26:File类的使用
1. File类的使用 package cn.itcast_01; import java.io.File; /* * 我们要想实现IO的操作,就必须知道硬盘上文件的表现形式. * 而Java就提供 ...
- MySQL:数据库入门篇1
1,什么是数据库?——存储数据的仓库 数据库技术是计算机应用领域中非常重要的技术,它产生于20世纪60年代末,是数据管理的最新技术,也是软件技术的一个重要分支. 简单的说,数据库就是一个存放数据的仓库 ...
- PAT (Basic Level) Practise (中文)-1040. 有几个PAT(25)
1040. 有几个PAT(25) http://www.patest.cn/contests/pat-b-practise/1040 字符串APPAPT中包含了两个单词“PAT”,其中第一个P ...
- PAT 1063. Set Similarity
1063. Set Similarity 题目大意 给定 n 个集合, k 个询问, 求任意两个集合的并集和合集. 思路 一道裸的考察 STL 中 set 的题, 我居然还用 hash 错过一遍, 用 ...
- 自定义AngularJS中的services服务
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- linux dentry cache 转自:http://blog.csdn.net/denzilxu/article/details/9188003
Linux dentry cache学习 每个dentry对象都属于下列几种状态之一: (1)未使用(unused)状态:该dentry对象的引用计数d_count的值为0,但其d_inode指针仍然 ...
- java和c通信相关的数据类型转换
利用socket进行网络传输的时候往往需要将int转换为bytes,将string转换为bytes以及一些其他类型的数据转换 java和c类型的区别: 变量类型 C中字节数 Java中字节数 int ...
- Oracle中with关键字的使用
open p_cr1 for with sqla as (select d.*, (select c.STATICMONTH from ly_zg_jzfbtstatic c where c.ID = ...
- 转载:Python中的if __name__ == '__main__'
刚开始学习Python时,对于有些书出现的函数带有“if __name__ == '__main__'”总是迷惑不解,比如<dive into Python>中开头的哪个根据输入的数字计算 ...