A11348 | Vlad and Division
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted