forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path6.cpp
More file actions
33 lines (30 loc) · 729 Bytes
/
6.cpp
File metadata and controls
33 lines (30 loc) · 729 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
27
28
29
30
31
32
33
#include <bits/stdc++.h>
using namespace std;
// N(가게의 부품 개수)와 M(손님이 확인 요청한 부품 개수)
int n, m;
int arr[1000001];
vector<int> targets;
int main(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" << ' ';
}
}
}