- Notifications
You must be signed in to change notification settings - Fork 846
/
Copy path6.cpp
33 lines (30 loc) · 729 Bytes
/
6.cpp
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
#include<bits/stdc++.h>
usingnamespacestd;
// N(가게의 부품 개수)와 M(손님이 확인 요청한 부품 개수)
int n, m;
int arr[1000001];
vector<int> targets;
intmain(void) {
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
arr[x] = 1;
}
cin >> m;
for (int i = 0; i < m; i++) {
int target;
cin >> target;
targets.push_back(target);
}
// 손님이 확인 요청한 부품 번호를 하나씩 확인
for (int i = 0; i < m; i++) {
// 해당 부품이 존재하는지 확인
if (arr[targets[i]] == 1) {
cout << "yes" << '';
}
else {
cout << "no" << '';
}
}
}