src2020/2713_fuwuqi/main.cpp

39 lines
813 B
C++

#include <algorithm>
#include <cstdio>
#include <iostream>
using namespace std;
struct lang {
int gao, id;
} a[4001];
bool pan(lang yi, lang er)
{
return yi.gao < er.gao;
}
int main()
{
int n, m;
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i].gao);
a[i].id = i;
}
sort(a + 1, a + 1 + n, pan);
scanf("%d", &m);
for (int i = 1; i <= m; i++) {
int tou, wei, diji;
scanf("%d%d%d", &tou, &wei, &diji);
int ce = 0;
for (int i = 1; i <= n; i++) {
if (a[i].id >= tou && a[i].id <= wei) {
ce++;
if (ce == diji) {
printf("%d\n", a[i].id);
break;
}
}
}
}
}