#include<bits/stdc++.h>
using namespace std;
const int N=2e5+5;
int vis[N],a[N],n,L,R;
bool check(int x){
memset(vis,0,sizeof vis);
vis[1]=1;
for(int i=1;i<=n;i++){
if(vis[i]==0||x<a[i])continue;
if(i+R>n)return vis[n+1]=1;
for(int j=i+L;j<=i+R;j++)
{
vis[j]=1;
}
}
return vis[n+1];
}
int main()
{
freopen(“B.in”,“r”,stdin);
freopen(“B.out”,“w”,stdout);
int t;
while(t–)
{
cin>>n>>L>>R;
long long l=1,r=n,ans=1e9;
for(int i=1;i<=n;i++)cin>>a[i];
while(l<=r)
{
long long mid=(l+r)/2;
if(check(a[mid]))
{
ans=min(ans,1ll*a[mid]);
r=mid-1;
}
else l=mid+1;
}
cout<<ans<<endl;
}
return 0;
}
照着老师讲的思路写的二分但是WA了
题目:https://www.xinyoudui.com/ac/contest/7450037530005040296FA96/problem/9387