_Niaoniao_ @ 2021-07-09 17:42:39
#include<bits/stdc++.h>
using namespace std;
int k,n,maxn,minn,sx[100001],a[100001];
int main(){
// freopen("window.in","r",stdin);
// freopen("window.out","w",stdout);
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>sx[i];
}
for(int i=1;i<=n-k+1;i++){
maxn=INT_MIN;
minn=INT_MAX;
for(int j=i;j<=i+k-1;j++){
maxn=max(maxn,sx[j]);
minn=min(minn,sx[j]);
}
cout<<minn<<' ';
a[i]=maxn;
}
cout<<endl;
for(int i=1;i<=n-k+1;i++){
cout<<a[i]<<' ';
}
return 0;
}
by _Niaoniao_ @ 2021-07-09 17:48:37
数组开1024*1024也有WA