Forming Surveillance Team

3.4

17 votes
Problem

Agent OO7 is engaged in a mission to stop the nuclear missile launch. He needs a surveillance team to monitor the progress of the mission. Several men with different type of capabilities assemble in a hall, help OO7 to find out total men with different capabilities. Capability is represented in form of numbers.

Input - First line contains 'T' test cases followed by 'T*2' lines, each pair containing,
1) Total number of men, M.
2) Capability value of each men, A[i].

Output - 'T' lines containing total men with different capabilities.

Constraints - 1<=T<=10^3, 1<=M<=10^5, 1<=A[i]<=10^5

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

1) For the 1st case, 1st line contains 6 men followed by 6 different capability values, i.e., {48,11,11,48,36,10}.
Since, 48,11,36,10 are 4 unique capability values, so the output is 4.

2) For the 2nd case, 1st line contains 4 men followed by 4 different capability values, i.e., {25,25,25,25}.
Since, 25 is the only unique capability value, so the output is 1.

Editor Image

?