-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1920.cpp
More file actions
38 lines (35 loc) · 735 Bytes
/
1920.cpp
File metadata and controls
38 lines (35 loc) · 735 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
35
36
37
38
#include <iostream>
#include <vector>
#include <algorithm>
#define io ios::sync_with_stdio(false); cin.tie(0);
using namespace std;
int main()
{
io;
int N,M,find;
cin>>N;
vector<int> A(N);
for(int i=0;i<N;i++) cin>> A[i];
cin>>M;
sort(A.begin(),A.end());
for(int i=0;i<M;i++) {
int m,low=0,high=N-1;
cin>>m;
while(true){
int mid=(low+high)/2;
if(low>high){
cout<<"0\n";
break;
}
if(m>A[mid]){
low=mid+1;
}else if(m<A[mid]){
high=mid-1;
}else{
cout<<"1\n";
break;
}
}
}
return 0;
}