FrankQian224 @ 2024-04-05 16:29:04
语言:C++14
#include<bits/stdc++.h>
using namespace std;
int main() {
long long n,m,num[1000000],a[100000],index=0;
cin>>n>>m;
while(cin>>num[index]) {
index++;
if(index==n) {
break;
}
}
index=0;
while(cin>>a[index]) {
index++;
if(index==n) {
break;
}
}
for(int i=0;i<m;i++) {
for(int j=0;j<n;j++) {
if(a[i]==num[j]) {
cout<<i+1<<" ";
break;
}
if(j==n-1) {
cout<<"-1 ";
}
}
}
return 0;
}