AC代码:
#include<iostream>
#include<algorithm>
using namespace std;
int a[1001],b[1001];
int main(){int n,m,l,r,k;scanf("%d",&n);for(int i=0;i<n;i++)scanf("%d",&a[i]);scanf("%d",&m);while(m--){scanf("%d%d%d",&l,&r,&k);for(int j=l-1,i=0;j<r;j++,i++)b[i]=a[j];sort(b,b+r-l+1);printf("%d\n",b[r-l-k+1]);}return 0;
}