- Notifications
You must be signed in to change notification settings - Fork 845
/
Copy path7.cpp
34 lines (31 loc) · 809 Bytes
/
7.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
34
#include<bits/stdc++.h>
usingnamespacestd;
// N(가게의 부품 개수)와 M(손님이 확인 요청한 부품 개수)
int n, m;
// 가게게 있는 전체 부품 번호를 담을 집합(set) 컨테이너
set<int> s;
vector<int> targets;
intmain(void) {
cin >> n;
for (int i = 0; i < n; i++) {
int x;
cin >> x;
s.insert(x);
}
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 (s.find(targets[i]) != s.end()) {
cout << "yes" << '';
}
else {
cout << "no" << '';
}
}
}