Untitled
Anonymous
plain_text
08/21/2024 2:19 AM
900 B
18
Indexable
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] a = new int[n];
for (int i = 0; i < n; i++) {
a[i] = sc.nextInt();
}
Set<Integer> seen = new HashSet<>();
for (int i = 0; i < n; i++) {
if (seen.contains(a[i])) {
System.out.println(1);
} else {
System.out.println(0);
seen.add(a[i]);
}
}
sc.close();
}
}
Editor is loading...
Leave a Comment