#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的更多相关文章

  1. [开发笔记] Graph Databases on developing

    TimeWall is a graph databases github It be used to apply mathematic model and social network with gr ...

  2. Introduction to graph theory 图论/脑网络基础

    Source: Connected Brain Figure above: Bullmore E, Sporns O. Complex brain networks: graph theoretica ...

  3. POJ 2125 Destroying the Graph 二分图最小点权覆盖

    Destroying The Graph Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8198   Accepted: 2 ...

  4. [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), ...

  5. [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), ...

  6. [LeetCode] Clone Graph 无向图的复制

    Clone an undirected graph. Each node in the graph contains a label and a list of its neighbors. OJ's ...

  7. 讲座:Influence maximization on big social graph

    Influence maximization on big social graph Fanju PPT链接: social influence booming of online social ne ...

  8. zabbix利用api批量添加item,并且批量配置添加graph

    关于zabbix的API见,zabbixAPI 1item批量添加 我是根据我这边的具体情况来做的,本来想在模板里面添加item,但是看了看API不支持,只是支持在host里面添加,所以我先在一个ho ...

  9. Theano Graph Structure

    Graph Structure Graph Definition theano's symbolic mathematical computation, which is composed of: A ...

随机推荐

  1. Linux下Kafka单机安装配置

    安装jdkJDK版本大于1.8 安装kafkatar -zxvf kafka_2.11-0.10.2.1.tgz mv kafka_2.11-0.10.2.1 /usr/local/kafka 配置k ...

  2. POJ 2342 树的最大独立集

    题意:在树的最大独立集的基础上,加上权值.求最大. 分析: 采用刷表的方式写记忆化,考虑一个点选和不选,返回方式pair 型. 首先,无根树转有根树,dp(root). 注意的是:u不选,那么他的子节 ...

  3. 【[APIO2012]派遣】

    题目 直接线段树合并就好了 之后在线段树上二分贪心选取金额较少的 如果是左偏树的话就开一个大根堆,根和子树顺次合并,合并之后堆内所有元素总和如果大于\(m\)就删除堆顶,由于每个元素只会被删除一次,所 ...

  4. android jni 之C语言基础

    *含义 1.乘法 3*5 2.定义指针变量 int * p://定义了一个名字叫p的变量,能够存放int数据类型的地址 3.指针运算符, //如果p是一个已经定义好的指针变量则*p表示以p的内容为地址 ...

  5. 10474 - Where is the Marble?(模拟)

    传送门: UVa10474 - Where is the Marble? Raju and Meena love to play with Marbles. They have got a lot o ...

  6. ASP.NET mvc 验证码 (转)

    ASP.net 验证码(C#) MVC http://blog.163.com/xu_shuhao/blog/static/5257748720101022697309/ 网站添加验证码,主要为防止机 ...

  7. 使用两个嵌套的for循坏探测2-100的所有素数

    只能被1和本身整除的整数才叫做素数 public class prime { public static void main(String[] args) { ; i <= ; i++) { ; ...

  8. select 文字右对齐

    select { direction: rtl; } select option { direction: ltr; }

  9. Openresty最佳案例 | 第9篇:Openresty实现的网关权限控制

    转载请标明出处: http://blog.csdn.net/forezp/article/details/78616779 本文出自方志朋的博客 简介 采用openresty 开发出的api网关有很多 ...

  10. Question 20171117 Java中的编码问题?

    撰文缘由 前几天做一个邮件发送功能,一些常用信息配置在properties文件中,通过prop.getProperty(key)来获取配置的信息,结果配置文件中是用中文写的,邮件发送成功后,邮箱中的激 ...