-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDistinct-Count.cpp
74 lines (60 loc) · 1.2 KB
/
Distinct-Count.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
Given an array
A
A of
N
N integers, classify it as being Good Bad or Average. It is called Good, if it contains exactly
X
X distinct integers, Bad if it contains less than
X
X distinct integers and Average if it contains more than
X
X distinct integers.
Input format:
First line consists of a single integer
T
T denoting the number of test cases.
First line of each test case consists of two space separated integers denoting
N
N and
X
X.
Second line of each test case consists of
N
N space separated integers denoting the array elements.
Output format:
Print the required answer for each test case on a new line.
Source: hackerearth
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t>0)
{
int n,x;int temp;
set<int> lonisa;
cin>>n>>x;
for(int i=0;i<n;i++)
{
cin>>temp;
lonisa.insert(temp);
}
if(lonisa.size()==x)
{
cout<<"Good\n";
}
else if(lonisa.size()<x)
{
cout<<"Bad\n";
}
else if(lonisa.size()>x)
{
cout<<"Average\n";
}
t--;
}
return 0;
}