Do it for the kids, Chuck!

A gang of nn vicious drug dealers is surrounding Walker, the world’s favourite Texas ranger. But do not worry! This would be a critical situation for most people, but not for Walker. He can hit all of them with just a single of his “spinning kicks”.

However, as this is a TV series, the co-guionist Aaron Norris has reminded his brother (the great actor Chuck Norris starring as Walker) that he should take care of several restrictions:

– “We must follow these rules, Chuck”, Aaron says. “I’m sure it’s not hard for you to find the maximum number of guys you can hit with a single spinning kick under these restrictions.”

– “Indeed, it is not”, Chuck replies after thinking for a couple of microseconds.

– “Then, Chuck, please, follow these rules. Do it for the kids, Chuck!”

– “Alright.”

Can you write a program to compute the maximum number of drug dealers that Chuck can hit with a single spinning kick under the given restrictions?

Input

Input begins with a number t≥0t \ge 0. Follow tt test cases, each with the number 0<n≤20000 < n \le 2000 of drug dealers, followed by t1,…,tnt_1, \ldots, t_n in ms. Each tit_i satisfies 0≤ti≤1090 \leq t_i \leq 10^9. (Chuck can really give such loooong spinning kicks. Indeed, he is a 6-time Karate World Champion!)

Output

Print tt lines with the answers.

Observation

Due to his Cherokee upbringing, Chuck can solve this problem in Θ(nlog⁡n)\Theta(n \log n) time. But you may be not as good a programmer as Chuck, so the Judge will accept quadratic solutions.

Problem information

Author: Omer Gimémez

Generation: 2026-01-25T10:26:27.316Z

© Jutge.org, 2006–2026.
https://jutge.org