Type: Default 2000ms 512MiB

连通块

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

连通块

题目描述

给定 mm不同的整数 a1,a2,,ama_1, a_2, \cdots, a_m,每个数都属于 [0,2n1][0,2^n−1] 的范围内.

一个图按照如下约束建立:

如果整数 XXYY 满足 X&Y=0X\&Y=0&\& 是按位与运算),则 XXYY 由一条无向边连接.

请计算图中连通分量的数量.

输入格式

输入包含 TT 组测试数据.

第一行包含一个整数 TT.

每组数据第一行包含两个整数 n,mn,m.

第二行包含 mm 个整数 a1,a2,,ama_1, a_2, \cdots, a_m.

输出格式

每组数据输出一行结果,表示连通分量的个数。

数据范围

  • 1T101\leq T \leq 10
  • 0n220\leq n \leq 22
  • 1m2n1\leq m\leq 2^n
  • 0ai<2n0\leq a_i < 2^n

输入输出样例

输入样例:

3
2 3
1 2 3
5 5
5 19 10 20 12
5 6
5 19 10 20 12 0

输出样例:

2
2
1

2025 SAST Algorithm Group SOC

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
9
Start at
2025-8-30 0:00
End at
2025-9-1 0:00
Duration
48 hour(s)
Host
Partic.
7