-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathCodeforces_0988A_Diverse_Team.java
More file actions
35 lines (34 loc) · 1014 Bytes
/
Codeforces_0988A_Diverse_Team.java
File metadata and controls
35 lines (34 loc) · 1014 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
31
32
33
34
35
// AC: 280 ms
// Memory: 900 KB
// hashset.
// T:O(n), S:O(k)
//
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Scanner;
public class Codeforces_0988A_Diverse_Team {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt(), k = sc.nextInt();
HashSet<Integer> record = new HashSet<>();
List<Integer> indexes = new LinkedList<>();
for (int i = 0; i < n; i++) {
int a = sc.nextInt();
if (indexes.size() < k && record.add(a)) {
indexes.add(i + 1);
}
}
if (indexes.size() == k) {
System.out.println("YES");
StringBuilder ret = new StringBuilder();
for (int i : indexes) {
ret.append(i);
ret.append(" ");
}
System.out.println(ret.toString().trim());
} else {
System.out.println("NO");
}
}
}