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 ...
随机推荐
- Android(java)学习笔记8:同步代码块 和 同步方法 的应用
1. 同步代码块 和 同步方法 代码示例: (1)目标类,如下: package cn.himi.text; public class SellTicket implements Runnable { ...
- solidity开发之windows下配置remix本地环境遇到的问题及解决
本人按照这个教程配置remix本地环境.[https://cloud.tencent.com/developer/article/1374376] win+R打开管理员终端,在欲配置为本地目录的路径执 ...
- 广义线性模型(GLM, Generalized Linear Model)
引言:通过高斯模型得到最小二乘法(线性回归),即: 通过伯努利模型得到逻辑回归,即: 这些模型都可以通过广义线性模型得到.广义线性模型是把自变量的线性预测函数当作因变量的估计值.在 ...
- android 学习笔记 杂记1
getIntent().getExtras().get("intent"); 这个intent是数据包装的参数. 比如: Intent intent = new Intent(th ...
- 前端DOM知识点
DOM即文档对象模型(Document Object Model,DOM)是一种用于HTML和XML文档的编程接口.它给文档提供了一种结构化的表示方法,可以改变文档的内容和呈现方式.DOM把网页和脚本 ...
- Javafxml
FXML入门教程 本部分教程包括两部分内容: 为什么使用FXML(基本介绍以及用FXML创建用户界面的好处): 使用FXML创建用户界面(通过创建简单登录应用来完成本教程部分). 1.1 为何使用FX ...
- update、commit、trancate,delete
update 用于更新表的数据,使用方式为: update table_name set column_name=值 条件 顺便一提:date数据插入更新应该使用 to_date()格式转换函数例如: ...
- vue入门: 实现选中并显示修改功能
1.实现功能 2.工具 vue 3.代码 <!DOCTYPE html> <html lang="en"> <head> <meta ch ...
- ABAP术语-Connection Type
Connection Type 原文:http://www.cnblogs.com/qiangsheng/archive/2008/01/17/1042479.html A connection ty ...
- Intellij IDEA切换maven
问题描述: IDEA自带Maven,但不想用,想用自己安装的. 解决方案: File->Settings(快捷键:Ctrl+Alt+S) 这里分为了两个,竟然还有默认配置一说,上面的只是修改了当 ...