CF2259B.Minus Two
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an array a1,a2,…,an. You may perform the following operation:
- For all indices i (1≤i≤n), set ai=∣ai−2∣.
Find the maximum possible frequency of any integer in a after performing the operation an arbitrary number (possibly zero) of times.
给你一个数组 a1,a2,…,an。你可以执行以下操作:
- 对所有下标 i(1≤i≤n),令 ai=∣ai−2∣。
求在执行任意次(可能为零次)该操作后,数组 a 中任意整数所能达到的最大出现频数。
输入格式
The first line of each input contains an integer t (1≤t≤104) — the number of test cases.
The first line of each test case contains an integer n (1≤n≤2⋅105) — the length of a.
The second line of each test case contains n integers a1,a2,…,an (1≤ai≤109) — the array a.
It is guaranteed that the sum of n over all test cases does not exceed 2⋅105.
每组输入的第一行包含一个整数 t(1≤t≤104)—— 测试用例的数量。
每个测试用例的第一行包含一个整数 n(1≤n≤2⋅105)—— 数组 a 的长度。
每个测试用例的第二行包含 n 个整数 a1,a2,…,an(1≤ai≤109)—— 数组 a。
保证所有测试用例的 n 之和不超过 2⋅105。
输出格式
For each test case, output a single integer denoting the maximum possible frequency of any integer in a after performing the operation an arbitrary number of times.
对于每个测试用例,输出一个整数,表示在执行该操作任意次数后,数组 a 中任意整数所能达到的最大可能频率。
输入输出样例
输入#1
5 2 1 3 4 1 1 1 2 3 6 7 8 4 2 2 2 2 5 1 10 100 1000 100000
输出#1
2 3 1 4 3
说明/提示
In the first test case, we can perform the operation once to have a=[∣1−2∣,∣3−2∣]=[1,1], which means the maximum possible frequency of any integer in a is 2.
In the second test case, the maximum frequency of an integer in a is 3. It can be shown that, no matter how many operations we perform, the maximum possible frequency of an integer in a will never exceed 3.
在第一个测试用例中,我们可以执行一次操作,得到 a=[∣1−2∣,∣3−2∣]=[1,1],这意味着 a 中任意整数的最大可能频数为 2。
在第二个测试用例中,a 中某个整数的最大频数为 3。可以证明,无论我们执行多少次操作,a 中任意整数的最大可能频数均不会超过 3。
输入解题思路,AI测评打分。不知道怎么写?