beigongbaishan @ 2024-06-09 20:14:38
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,k,a[1000005];
cin>>n>>k;
for(int i=1;i<=n;i++){
cin>>a[i];
}
for(int i=1;i<=n-k+1;i++){
cout<<min(min(a[i],a[i+1]),a[i+2])<<" ";
}
cout<<endl;
for(int i=1;i<=n-k+1;i++){
cout<<max(max(a[i],a[i+1]),a[i+2])<<" ";
}
return 0;
}
by yaomengshun @ 2024-06-17 20:10:50
谁告诉你窗口大小一定为3的??? @beigongbaishan