[shuju]一道簡單題 Uva 11991



#include <cstdio>
#include <map>
#include <vector>

using namespace std;


int main(){
	map<int, vector<int> > a;
	int n, int m;
	while (scanf("%d%d", &n, &m) == 2){
		for (int i = 0; i < n; i++){
			int x;
			scanf("%d", &x);
			if (!a.count(x)){
				a[x] = vector<int>();

			}
			else
			{
				a[x].push_back(i + 1);
			}
		}
		while (m--)
		{
			int k, v;
			scanf("%d%d", &k, &v);
			printf("%d", a[v][k-1]);	
		}

	}
	return 0;

}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章