Last active
August 29, 2015 14:22
-
-
Save s25g5d4/1fa1e5897147c5efc0f9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
int main() | |
{ | |
using namespace std; | |
while (true) { | |
int n, m; | |
cin >> n >> m; | |
if (cin.eof()) | |
break; | |
vector<vector<int>> occurence(1000000); | |
int i = 0; | |
while (n--) { | |
int u; | |
cin >> u; | |
--u; | |
occurence[u].push_back(++i); | |
} | |
while (m--) { | |
unsigned int k, v; | |
cin >> k >> v; | |
--k; | |
--v; | |
if (occurence[v].size() <= k) | |
cout << '0' << endl; | |
else | |
cout << occurence[v][k] << endl; | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment