chris731 @ 2023-05-14 13:11:31
#include<bits/stdc++.h>
using namespace std;
const long long MAXN=1e7+10;
long long a[MAXN];
int main(){
long long n,m,k,y;
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>y;
if(a[y]==0){
a[y]=i;
}
}
for(int i=1;i<=m;i++){
cin>>k;
if(a[k]==0){
cout<<"-1 ";
}else{
cout<<a[k]<<" ";
}
}
return 0;
}
by Infinite_Energy @ 2023-05-14 13:14:56
值域1e9,开1e7的数组明显小了
by chris731 @ 2023-05-14 14:32:33
谢 %