-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDistinctCount.java
More file actions
30 lines (29 loc) · 796 Bytes
/
DistinctCount.java
File metadata and controls
30 lines (29 loc) · 796 Bytes
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
/**
* https://www.hackerearth.com/practice/data-structures/trees/binary-search-tree/practice-problems/algorithm/distinct-count/
* #binary-search-tree
*/
import java.util.Scanner;
import java.util.TreeSet;
public class DistinctCount {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int tc = sc.nextInt();
int x, n, tmp;
for (int t = 0; t < tc; t++) {
n = sc.nextInt();
x = sc.nextInt();
TreeSet<Integer> ts = new TreeSet<>();
for (int i = 0; i < n; i++) {
tmp = sc.nextInt();
ts.add(tmp);
}
if (x == ts.size()) {
System.out.println("Good");
} else if (x < ts.size()) {
System.out.println("Average");
} else {
System.out.println("Bad");
}
}
}
}