UVA 11991 Easy Problem from Rujia Liu?

时间:2022-08-06 10:27:30

题目链接

 

 1 #include <cstdio>
 2 #include <map>
 3 #include <vector>
 4 using namespace std;
 5 map<int,vector<int>> ma;
 6 int main()
 7 {
 8     int n,m,x,k,v,num;
 9     while(scanf("%d%d",&n,&m)==2){
10         ma.clear();
11         for(int i=1;i<=n;i++){
12             scanf("%d",&x);
13             ma[x].push_back(i);
14         }
15         for(int i=0;i<m;i++){
16             scanf("%d%d",&k,&v);
17             if(ma[v].size()<k) puts("0");
18             else printf("%d\n",ma[v][k-1]);
19         }
20     }
21 }