kabout @ 2021-08-13 23:47:28
#include<bits/stdc++.h>
using namespace std;
int f[100][30],n,m;
int main()
{
cin>>n>>m;
for(int i=1;i<=n;i++)cin>>f[i][0];
for(int j=1;j<=30;j++)
for(int i=1;i+(1<<j)-1<=n;i++)
f[i][j]=min(f[i][j-1],f[i+(1<<(j-1))][j-1]);
int k=-1,tmp=m;
while(tmp>>1){k++;tmp=tmp>>1;}
cout<<0<<endl;
cout<<f[1][0]<<endl;
for(int i=3;i<=n;i++)
{
int z,t=-1;
if(i-m<1)
{
z=i-1;
while(z>>1){t++;z=z>>1;}
cout<<min(f[1][z],f[i-(1<<z)][z])<<endl;
}
cout<<min(f[i-m][k],f[i-(1<<k)][k])<<endl;
}
return 0;
}
by _caiji_ @ 2021-08-13 23:50:51
int f[100][30],n,m;
// ^~~
by kabout @ 2021-08-13 23:52:04
else cout<<min(f[i-m][k],f[i-(1<<k)][k])<<endl; 少些个else(还是错的)
by kabout @ 2021-08-13 23:52:27
哦!!
by kabout @ 2021-08-13 23:54:12
10分,剩下3个tle,六个WA,我没救了。。。