tjhdyhj @ 2020-08-24 15:45:29
10 5 8 5 18 12 18 12 10 7 15 1
#include <iostream>
using namespace std;
int main()
{
long int N,m,max,i,j;
cin>>N>>m;
int n[N+5];
for (i=-m;i<=0;i++)
{
n[i]=30000005;
}
for (i=1;i<=N;i++)
{
cin>>n[i];
}
cout<<"0"<<endl;
for (i=2;i<=N;i++)
{
max=30000005;
for (j=i-m;j<i;j++)
{
if (n[j]<max)
max=n[j];
}
cout<<max<<endl;
}
return 0;
}```
by tjhdyhj @ 2020-08-24 15:48:16
那是第二个测试点数据
by JRzyh @ 2020-08-24 15:48:47
啊nbnb
by JRzyh @ 2020-08-24 15:49:19
建议自学时间复杂度
by JRzyh @ 2020-08-24 15:50:11
for (i=-m;i<=0;i++)
负下标可太牛了
by _5011_ @ 2020-08-24 15:50:40
for (i=-m;i<=0;i++)
{
n[i]=30000005;
}
我还能说啥
by tjhdyhj @ 2020-08-24 15:51:54
额不行吗
by sky_light @ 2020-08-24 15:54:21
负数下标着实理直气壮
by AMIRIOX無暝 @ 2020-08-24 15:56:50
其实重点不在于负下标 在于他越界了...
有些时候负数下标是可以的 Redis里就有
他的问题是他越界了
by Merron @ 2020-08-24 15:57:50
艹负下标
by shenhao @ 2020-08-24 15:58:16
嘤嘤嘤