Untitled
raw download clone
TEXT
views 22
,
size 752 b
#include<stdio.h>
#define MAX 1000000001
int main()
{
    int t,n,m,k;
    int record,temp,ans;
    scanf("%d",&t);
    for(int i=1;i<=t;i++){
        scanf("%d%d%d",&n,&m,&k);
        int a[n+1];
        for(int j=1;j<=n;j++){
            scanf("%d",&a[i]);
        }
        if(m<=k) k=m-1;
        ans=0;
        for(int x=0;x<=k;x++){
            temp=MAX;
            for(int y=0;y<=m-k-1;y++){
                if(a[x+y+1]>a[x+y+n-m+1])
                    record=a[x+y+1];
                else
                    record=a[x+y+n-m+1];
                if(record<temp)
                    temp=record;
            }

            if(temp>ans)
                ans=temp;

        }
        printf("%d\n",ans);
    }
}
close fullscreen
Login or Register to edit or fork this paste. It's free.