我将代码放到oj上运行后显示runtime error,请问如何解决?以下是代码:
#include <stdio.h>
#include <stdlib.h>
int main()
{
int t,n,m,a[10][10]={0},ans[10][3]={0},tmp[10]={0};
scanf("%d",&t);
for (int i=0;i<t;++i)
{
scanf("%d%d",&n,&m);
for (int j=0;j<n;++j)//ÊäÈë
{
for (int k=0;k<m;++k)
{
scanf("%d",&a[j][k]);
}
}
for (int j=0;j<n;++j)
{
for (int k=0;k<m-1;++k)
{
if (a[j][k]<=a[j][k+1])
{
ans[i][0]=1;
}
else
{
ans[i][0]=0;
k=m-1;
j=n;
}
}
}
for (int i2=0;i2<t;++i2)//*
{
if (ans[i2][0]==0)
{
for (int j=0;j<=m-2;++j)
{
for (int k=j+1;k<=m-1;++k)
{
for (int s=0;s<n;++s)//swap
{
tmp[s]=a[s][j];
}
for (int s=0;s<n;++s)
{
a[s][j]=a[s][k];
}
for (int s=0;s<n;++s)
{
a[s][k]=tmp[s];
}//
for (int j1=0;j1<n;++j1)//jian ce
{
for (int k1=0;k1<m-1;++k1)
{
if (a[j1][k1]<=a[j1][k1+1])
{
ans[i2][1]=j+1;
ans[i2][2]=k+1;
ans[i2][0]=2;
}
else
{
ans[i2][0]=3;
k1=m-1;
j1=n;
}
}
}//
for (int s=0;s<n;++s)
{
tmp[s]=a[s][k];
}
for (int s=0;s<n;++s)
{
a[s][k]=a[s][j];
}
for (int s=0;s<n;++s)
{
a[s][j]=tmp[s];
}
}
}
}
}
for (int j=0;j<n;++j)//
{
for (int k=0;k<m;++k)
{
a[j][k]=0;
}
}
}
for (int i=0;i<t;++i)//*
{
if (ans[i][0]==1)
{
printf("1 1\n");
}
else if (ans[i][0]==2)
{
printf("%d %d\n",a[i][1],a[i][2]);
}
else if (ans[i][0]==3)
{
printf("-1\n");
}
}
return 0;
}