题解
2025-07-16 17:39:03
发布于:广东
0阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int n,a[1000001],x,m;
int main(){
cin>>n>>m;
for(int i=1;i<=n;i++)cin>>a[i];
for(int i=1;i<=m;i++){
cin>>x;
int pos=lower_bound(a+1,a+n+1,x)-a;
if(a[pos]==x)cout<<pos<<" ";
else cout<<-1<<" ";
}
return 0;
}
这里空空如也
有帮助,赞一个