#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. position中需要注意的地方

    relative是相对元素本身位置进行移位,但不会改变本身位置的大小 本身的位置 移位后,可以看到,p5的位置还是在那,并不会自动往上走,也就是p2的位置原来所占据的位置不变的.不会因为偏移而改变布局 ...

  2. Springmvc+Mybatis+Velocity实现小demo(Maven项目)

    转:https://blog.csdn.net/FoolishAndStupid/article/details/52005934 Velocity只是充当一个展示层,和JSP的功能类似,利用myba ...

  3. SP348 EXPEDI - Expedition

    嘟嘟嘟 水贪心. 当经过一个加油站的时候,记下这个加油站能加的油,然后没油的时候从经过的加油站中选择加油最多的加. #include<cstdio> #include<iostrea ...

  4. UVA11294 Wedding

    嘟嘟嘟 大佬们都说这是2-SAT入门题,然而对于刚学2_SAT的本菜鸡来说半天才理解…… 题面:新娘和新郎不能坐在同一侧,妻子和丈夫不能坐在同一侧,有**关系的两个人必须至少一个坐在新娘一侧,问方案. ...

  5. HDU 5025 Saving Tang Monk 【状态压缩BFS】

    任意门:http://acm.hdu.edu.cn/showproblem.php?pid=5025 Saving Tang Monk Time Limit: 2000/1000 MS (Java/O ...

  6. MvcApplication 中方法的那点事

    最近比较闲,不知道干点啥,想找兼职没有合适的,不找工资又不够花,o(︶︿︶)o 唉! 说多了都是泪,入正题吧. 首先,新建一个MVC4.0项目,建好之后打开Global.asax文件,在MVCAppl ...

  7. 话说"登录页面"怎么测试

    今天无聊突然想起web登录页面怎么测试,看似简单的问题杀机重重,怎么说呢,一般没有测试思维的人说简单啦,主要有以下几点 .1.账号密码框输入正确的a-z,A-Z,0-9字符,特殊的字符组合测试.2.账 ...

  8. zepto 基础知识(2)

    20.append append(content) 类型:self 在每个匹配的元素末尾插入内容(内部插入).内容可以为html 字符串.dom节点,或者节点组成的数组. $('ul').append ...

  9. 搭建mysql主从复制和删库数据恢复策略

    搭建主从复制 主机: [mysqld] 下增加 vim /etc/my.cnf ## 设置 server_id,一般设置为 IP server_id=8 # # 复制过滤:需要备份的数据库,输出 bi ...

  10. DRF知识