forked from ndb796/python-for-coding-test
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path7.cpp
More file actions
34 lines (31 loc) Β· 809 Bytes
/
7.cpp
File metadata and controls
34 lines (31 loc) Β· 809 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
34
#include <bits/stdc++.h>
using namespace std;
// N(κ°κ²μ λΆν κ°μ)μ M(μλμ΄ νμΈ μμ²ν λΆν κ°μ)
int n, m;
// κ°κ²κ² μλ μ 체 λΆν λ²νΈλ₯Ό λ΄μ μ§ν©(set) 컨ν
μ΄λ
set<int> s;
vector<int> targets;
int main(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" << ' ';
}
}
}