[백준] 📂. (1920번) 수 찾기
🗒️ 1920번) 수 찾기
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
vector<int> vec;
int N;
cin >> N;
for (int i = 0; i < N; i++)
{
int a;
cin >> a;
vec.push_back(a);
}
sort(vec.begin(), vec.end());
int M;
cin >> M;
while (M--)
{
int m;
cin >> m;
if (binary_search(vec.begin(), vec.end(), m))
cout << 1 << '\n';
else
cout << 0 << '\n';
}
return 0;
}
댓글남기기