自己看
2026-08-18 10:41:14
发布于:广东
1阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,m;
ll a[1000010];
ll b[1000010];
int main(){
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout.tie(nullptr);
cin>>n>>m;
for(ll i=1;i<=n;i++) cin>>a[i];
while(m--){
ll x;
cin>>x;
ll tar=lower_bound(a+1,a+1+n,x)-a;
if(a[tar]==x){
cout<<tar<<" ";
}else{
cout<<-1<<" ";
}
}
//fclose(stdin);
//fclose(stdout);
return 0;
}
//coder::by::M91
这里空空如也






有帮助,赞一个