-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBJAlgo_1920.java
More file actions
26 lines (22 loc) · 906 Bytes
/
Copy pathBJAlgo_1920.java
File metadata and controls
26 lines (22 loc) · 906 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
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.Set;
import java.util.stream.Collectors;
public class BJAlgo_1920 {
public static void main(String[] args) throws Exception {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] nums = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
Set<Integer> set = Arrays.stream(nums).boxed().collect(Collectors.toSet());
int m = Integer.parseInt(br.readLine());
int[] finds = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
for (int num : finds) {
if (set.contains(num)) {
System.out.println(1);
} else {
System.out.println(0);
}
}
}
}