#include <bits/stdc++.h>
using namespace std;
int main(void){
ios::sync_with_stdio(0);
cin.tie(0);
int n, m, a, b;
vector<int> v;
cin >> n ; //5
for(int i =0; i<n;i++){
cin >> a;
v.push_back(a);
}
sort(v.begin(), v.end()); // 정렬
cin >> m; //5
for(int i=0; i<m;i++){
cin>>b;
if(binary_search(v.begin(),v.end(),b )) cout << 1 << "\n";
else cout << 0 << "\n";
}
}
'CPP 문제풀이 > 백준' 카테고리의 다른 글
백준 10815번 : 숫자 카드 (0) | 2020.09.22 |
---|---|
백준 10989번 : 수 정렬하기 3 (0) | 2020.09.18 |
알고리즘 길라잡이 따라 풀기 - 3 (0) | 2020.09.14 |
알고리즘 길라잡이 따라 풀기 - 2 (0) | 2020.09.14 |
알고리즘 길라잡이 따라 풀기 - 1 (0) | 2020.09.14 |