douhuazhenren1 @ 2024-01-18 19:52:05
#include<bits/stdc++.h>
using namespace std;
const int N=1000010;
int main()
{
int n,k,a[N]={0},b[N];
cin>>n>>k;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
for(int i=3;i<=n;i++)
{
cout<<min(a[i-2],min(a[i],a[i-1]))<<" ";
b[i]=max(a[i],max(a[i-1],a[i-2]));
}
for(int i=1;i<n+2;i++)
{
if(b[i]==0)
{
continue;
}
cout<<b[i]<<" ";
}
return 0;
}
by douhuazhenren1 @ 2024-01-18 19:54:31
呵呵中间加一个换行拿了十分
by wang_ly_ly @ 2024-01-18 19:55:52
啊?
by _mkx2023257_ @ 2024-01-18 19:56:17
k不一定是3
by rhn7 @ 2024-01-18 19:56:54
题目让滑动长度为k的窗口,你不能直接滑动长度为3的窗口
by douhuazhenren1 @ 2024-01-18 21:02:53
原来这样,没审清题,谢谢大家 @rhn7 @mkx2023257 @wang_ly_ly