-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBAEKJOON_10815_re
More file actions
41 lines (34 loc) · 1.16 KB
/
BAEKJOON_10815_re
File metadata and controls
41 lines (34 loc) · 1.16 KB
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
36
37
38
39
40
41
import java.io.*;
import java.sql.Array;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bw =new BufferedWriter(new OutputStreamWriter(System.out));
HashMap<Integer,Integer> map = new HashMap<>();
int myCard =Integer.parseInt(br.readLine());
StringTokenizer st = new StringTokenizer(br.readLine());
int temp =0;
for(int i=0; i<myCard; i++){
temp = Integer.parseInt(st.nextToken());
if(!map.isEmpty() && map.containsKey(temp)){
map.replace(temp,map.get(temp)+1);
}else{
map.put(temp,1);
}
}
int Num = Integer.parseInt(br.readLine());
st= new StringTokenizer(br.readLine());
for(int i=0; i<Num; i++){
temp = Integer.parseInt(st.nextToken());
if(map.containsKey(temp)){
bw.write("1 ");
}else{
bw.write("0 ");
}
}
bw.flush();
bw.close();
map.clear();
}
}