A11348. Vlad and Division
编程题
普及/提高-
知识点
题目描述
The first line contains a single integer $t$ ( $1 \leq t \leq 10^4$ ) — the number of test cases.
The first line of each test case contains a single integer $n$ ( $1 \leq n \leq 2 \cdot 10^5$ ) — the total number of integers.
The second line of each test case contains $n$ given integers $a_1, \ldots, a_n$ ( $0 \leq a_j < 2^{31}$ ).
The sum of $n$ over all test cases in a test does not exceed $2 \cdot 10^5$ .
The first line of each test case contains a single integer $n$ ( $1 \leq n \leq 2 \cdot 10^5$ ) — the total number of integers.
The second line of each test case contains $n$ given integers $a_1, \ldots, a_n$ ( $0 \leq a_j < 2^{31}$ ).
The sum of $n$ over all test cases in a test does not exceed $2 \cdot 10^5$ .
输入格式
For each test case, output a single integer — the minimum number of groups required to satisfy the condition.
输出格式
In the first test case, any two numbers have the same last $31$ bits, so we need to place each number in its own group.
In the second test case, $a_1=0000000000000000000000000000000_2$ , $a_2=1111111111111111111111111111111_2$ so they can be placed in the same group because $a_1(i) \ne a_2(i)$ for each $i$ between $1$ and $31$ , inclusive.
In the second test case, $a_1=0000000000000000000000000000000_2$ , $a_2=1111111111111111111111111111111_2$ so they can be placed in the same group because $a_1(i) \ne a_2(i)$ for each $i$ between $1$ and $31$ , inclusive.
输入输出样例
输入 #1
9 4 1 4 3 4 2 0 2147483647 5 476319172 261956880 2136179468 1671164475 1885526767 3 1335890506 811593141 1128223362 4 688873446 627404104 1520079543 1458610201 4 61545621 2085938026 1269342732 1430258575 4 0 0 2147483647 2147483647 3 0 0 2147483647 8 1858058912 289424735 1858058912 2024818580 1858058912 289424735 122665067 289424735
输出 #1
4 1 3 2 2 3 2 2 4
说明/提示
In the first test case, any two numbers have the same last $31$ bits, so we need to place each number in its own group.
In the second test case, $a_1=0000000000000000000000000000000_2$ , $a_2=1111111111111111111111111111111_2$ so they can be placed in the same group because $a_1(i) \ne a_2(i)$ for each $i$ between $1$ and $31$ , inclusive.
In the second test case, $a_1=0000000000000000000000000000000_2$ , $a_2=1111111111111111111111111111111_2$ so they can be placed in the same group because $a_1(i) \ne a_2(i)$ for each $i$ between $1$ and $31$ , inclusive.