CF986C.AND Graph
省选/NOI-
通过率:0%
时间限制:4.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given a set of size m with integer elements between 0 and 2n−1 inclusive. Let's build an undirected graph on these integers in the following way: connect two integers x and y with an edge if and only if x&y=0. Here & is the bitwise AND operation. Count the number of connected components in that graph.
给你一个大小为 m 的集合,其中元素为介于 0 和 2n−1(含)之间的整数。我们按如下方式在这些整数上构建一个无向图:当且仅当 x&y=0 时,在整数 x 和 y 之间连一条边。这里 & 表示按位与运算。求该图中连通块的个数。
输入格式
In the first line of input there are two integers n and m (0≤n≤22, 1≤m≤2n).
In the second line there are m integers a1,a2,…,am (0≤ai<2n) — the elements of the set. All ai are distinct.
输入的第一行包含两个整数 n 和 m(0≤n≤22,1≤m≤2n)。
第二行包含 m 个整数 a1,a2,…,am(0≤ai<2n),表示集合的元素。所有 ai 互不相同。
输出格式
Print the number of connected components.
输出连通分量的数量。
输入输出样例
输入#1
2 3 1 2 3
输出#1
2
输入#2
5 5 5 19 10 20 12
输出#2
2
说明/提示
Graph from first sample:

Graph from second sample:

第一个样例的图:

第二个样例的图:

输入解题思路,AI测评打分。不知道怎么写?