Want Some Candies

View as PDF

Submit solution


Points: 10 (partial)
Time limit: 1.0s
Memory limit: 32M

Author:
Problem type
Allowed languages
Python

Alice has n candies, where the i th candy is of type C_i. Alice noticed that she started to gain weight, so she visited a doctor.

The doctor advised Alice to only eat n/2 of the candies she has (n is always even). Alice likes her candies very much, and she wants to eat the maximum number of different types of candies while still following the doctor's advice.

Given an integer array of length n, return the maximum number of different types of candies she can eat if she only eats n/2 of them.

Input Specification

The first line of the input gives the number of test cases, T, and then T test cases follow.

For each test case, it will consist of one line which contains n integers separated by spaces, where the i th integer C_i represents the candy type of i th candy.

Constraints

1 \leq T \leq 100

0 \leq C_i \leq 50

1 \leq n \leq 100

Output Specification

For each test case, output one line containing Case #x: y, where x is the case number(starting from 1), and y is the maximum number of different type of candies Alice can eat if she only eats n/2 of them.

Sample Input

2
1 1 2 2 3 3
6 6 6 6

Sample Output

Case #1: 3
Case #2: 1

Hint

set min/max

Reference

https://leetcode.com/problems/distribute-candies/description/


Comments

There are no comments at the moment.