-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathBinary-Search-Tree-Using-STL.cpp
59 lines (48 loc) · 1.12 KB
/
Binary-Search-Tree-Using-STL.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
// Given an array A of N integers, classify it as being Good Bad or Average. It is called Good, if it contains exactly X distinct integers, Bad if it contains less than X distinct integers and Average if it contains more than X distinct integers.
// Input format:
// First line consists of a single integer T denoting the number of test cases.
// First line of each test case consists of two space separated integers denoting N and X.
// Second line of each test case consists of N space separated integers denoting the array elements.
// Output format:
// Print the required answer for each test case on a new line.
// Constraints:
// SAMPLE INPUT
// 4
// 4 1
// 1 4 2 5
// 4 2
// 4 2 1 5
// 4 3
// 5 2 4 1
// 4 4
// 1 2 4 5
// 4 3
// 1 2 3 4
// SAMPLE OUTPUT
// Average
// Average
// Average
// Good
// Average
#include<bits/stdc++.h>
using namespace std;
int main(){
long long t;
cin>>t;
for(int a=0;a<t;a++){
long long n,x;
cin>>n;
cin>>x;
set<long long> s;
int b;
for( long long i=0;i<n;i++)
{
cin>>b;
s.insert(b);
}
if(s.size()==x){cout<<"Good"<<endl;}
if(s.size()<x){cout<<"Bad"<<endl;}
if(s.size()>x){cout<<"Average"<<endl;
}
}
}