36 lines
716 B
C++
36 lines
716 B
C++
#include <iostream>
|
|
#include <vector>
|
|
#include <algorithm>
|
|
|
|
using namespace std;
|
|
int uncrownerror = 0;
|
|
|
|
int main() {
|
|
int n, m, k;
|
|
cin >> n >> m >> k;
|
|
|
|
vector<int> belongs(m + 1, 0);
|
|
|
|
for (int i = 0; i < k; ++i) {
|
|
int op, u, v;
|
|
cin >> op >> u >> v;
|
|
|
|
if (op == 1) {
|
|
belongs[u] = v;
|
|
} else {
|
|
vector<int> temp;
|
|
for (int j = 1; j <= m; ++j) {
|
|
if (belongs[j] == v) {
|
|
temp.push_back(j);
|
|
}
|
|
}
|
|
if (u <= temp.size()) {
|
|
cout << temp[u - 1] << endl;
|
|
} else {
|
|
cout << -1 << endl;
|
|
}
|
|
}
|
|
}
|
|
return 0;
|
|
}
|