You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
671 B
31 lines
671 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
int main() {
|
|
//输入+输出重定向
|
|
//freopen("../x.in", "r", stdin);
|
|
//freopen("../x.out", "w", stdout);
|
|
int n;
|
|
scanf("%d", &n);
|
|
unordered_map<int, int> _map;
|
|
for (int i = 1; i <= n; ++i) {
|
|
int c;
|
|
scanf("%d", &c);
|
|
_map[c] = i; //key:个数,value:位置
|
|
}
|
|
int q;
|
|
scanf("%d", &q);
|
|
for (int i = 0; i < q; ++i) {
|
|
int m;
|
|
scanf("%d", &m);
|
|
if (_map.count(m) > 0) printf("%d\n", _map[m]);
|
|
else printf("%d\n", 0);
|
|
}
|
|
|
|
//关闭文件
|
|
//fclose(stdin);
|
|
//fclose(stdout);
|
|
return 0;
|
|
}
|