链接
https://vjudge.net/problem/UVA-11991
题解
直接开1e6个vector
代码
#include <bits/stdc++.h>
#define maxn 1000010
using namespace std;
vector<int> pos[maxn];
int main()
{
int i, n, m, x, k, v;
while(~scanf("%d%d",&n,&m))
{
for(i=1;i<maxn;i++)pos[i].clear();
for(i=1;i<=n;i++)
{
scanf("%d",&x);
pos[x].push_back(i);
}
while(m--)
{
scanf("%d%d",&k,&v);
if(pos[v].size()<k)printf("0\n");
else printf("%d\n",pos[v].at(k-1));
}
}
return 0;
}