#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 1010;
bool cmp(int a, int b) {
return a > b;
}
int main() {
int n, m ,number[MAXN];
scanf("%d",&n);
for(int i=1; i<=n; i++) {
scanf("%d",&number[i]);
}
scanf("%d",&m);
for(int i=0; i<m; i++) {
int l, r, k, number2[MAXN];
scanf("%d%d%d",&l,&r,&k);
int cnt = 0;
for(int j=l; j<=r; j++) {
number2[cnt++] = number[j];
}
sort(number2,number2+cnt,cmp);
printf("%d\n",number2[k-1]);
}
}
ALGO-1 区间k大数查询
最新推荐文章于 2020-05-12 15:55:37 发布