测评机: Xeond[6]
得分: 90分
提交日期: 2012-6-16 9:06:00
有效耗时: 437毫秒
测试结果1: 通过本测试点|有效耗时62ms
测试结果2: 通过本测试点|有效耗时47ms
测试结果3: 通过本测试点|有效耗时47ms
测试结果4: 通过本测试点|有效耗时47ms
测试结果5: 通过本测试点|有效耗时47ms
测试结果6: 通过本测试点|有效耗时47ms
测试结果7: 通过本测试点|有效耗时47ms
测试结果8: 通过本测试点|有效耗时46ms
测试结果9: 通过本测试点|有效耗时47ms
测试结果10: 测试结果错误.错误结果为:10
正确结果应为:9900
#include<stdio.h>
int r,c,max=0;
int d[103][103],f[103][103],q[10300][2],xx[4]={0,0,1,-1},yy[4]={-1,1,0,0};
main()
{
int i,j,k;
scanf("%d %d",&r,&c);
for(i=1;i<=r;i++)
for(j=1;j<=c;j++)
{
scanf("%d",&d[i][j]);
f[i][j]=1;
}
for(i=1;i<=r;i++)
for(j=1;j<=c;j++)
{
int h=0,l=1;
q[l][1]=i;
q[l][2]=j;
while(h<l)
{
++h;
int x=q[h][1],y=q[h][2];
for(k=0;k<4;k++)
{
int x1=x+xx[k],y1=y+yy[k];
if(x1>0&&x1<=r&&y1>0&&y1<=c&&d[x][y]<d[x1][y1]&&f[x][y]+1>f[x1][y1])
{
f[x1][y1]=f[x][y]+1;
++l;
q[l][1]=x1;
q[l][2]=y1;
}
}
}
}
for(i=1;i<=r;i++)
for(j=1;j<=c;j++)
if(f[i][j]>max)
max=f[i][j];
printf("%d",max);
return 0;
}
求解,为什么第十个数据过不了?