Untitled

mail@pastecode.io avatar
unknown
plain_text
24 days ago
673 B
2
Indexable
Never
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(); 
    }
}
Leave a Comment