Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
- long long int a[10000000],b[1000001];
- int main()
- {
- fastio;
- int n, q;
- cin>>n>>q;
- for(int i=0;i<n;i++)
- {
- cin>>a[i];
- b[a[i]]=1;
- }
- while(q--)
- {
- long long int tmp;
- cin>>tmp;
- if(b[tmp])
- cout<<lower_bound(a,a+n,tmp)-a<<endl;
- else
- cout<<"-1"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement