Untitled
raw download clone
TEXT
views 20
,
size 816 b
#include<stdio.h>
#define MAX 1000000001
int main()
{
    int t,n,m,k;
    int record,temp,ans;
    scanf("%d",&t);
    for(int g=1; g<=t; g++){
        scanf("%d%d%d",&n,&m,&k);
        int a[n+1];
        for(int i=1; i<=n; i++)
        {
            scanf("%d",&a[i]);
        }

        ans=0;
        if(m<=k)
            k=m-1;
        for(int j=0;j<=k;j++){
            temp=MAX;
            //ans=0;
            for(int i=0;i<=m-k-1;i++){
                if(a[j+i+1]>a[j+i+n-m+1])
                    record=a[j+i+1];
                else
                    record=a[j+n-m+i+1];
                if(record<=temp)
                    temp=record;
            }
            if(temp>=ans)
                ans=temp;

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