damuzhi @ 2023-11-15 19:51:58
#include <bits/stdc++.h>
using namespace std;
int main() {
int n,m;
cin >> n >> m;
int b[n];
for(int i = 0; i < n; i++){
cin >> b[i];
}
int l;
for(int i = 0; i < m; i++){
cin >> l;
for(int j = 0; j < n; j++){
if(b[j] == l){
cout << j + 1 << ' ';
break;
}
if(j == n - 1){
cout << -1 << ' ';
break;
}
}
}
return 0;
}
by yzdcde @ 2023-11-15 19:57:19
这题要用二分
by damuzhi @ 2023-11-15 20:02:50
谢谢Thanks♪(・ω・)ノ