```cpp
//修改过了还是TLE
#include<cstdio>
using namespace std;
int main()
{
int n,i,j;
scanf("%d",&n);
int a[n][n];
for(i=0;i<n;i++)
for(j=0;i<n;j++)
scanf("%d",&a[i][j]);
for(i=0;i<n;i++)
{
if(a[0][i]==0)
{
for(j=0;j<n;j++)
{
if(a[j][i]==0)
a[j][i]=3;
else
break;
}
}
}
for(i=0;i<n;i++)
{
if(a[i][0]==0)
{
for(j=0;j<n;j++)
{
if(a[i][j]==0)
a[i][j]=3;
else
break;
}
}
}
for(i=0;i<n;i++)
{
if(a[i][n-1]==0)
{
for(j=0;j<n;j++)
{
if(a[i][j]==0)
a[i][j]=3;
else
break;
}
}
}
for(i=0;i<n;i++)
{
if(a[n-1][i]==0)
{
for(j=0;j<n;j++)
{
if(a[j][i]==0)
a[j][i]=3;
else
break;
}
}
}
for(i=0;i<n;i++)
{
for(j=0;j<n;j++)
{
if(a[i][j]==0)
a[i][j]=2;
if(a[i][j]==3)
a[i][j]=0;
printf("%d ",a[i][j]);
}
printf("\n");
}
return 0;
}
```
by Accepted_233 @ 2017-07-23 10:24:29
@[Jessie\_](/space/show?uid=48544)
#我不知道
by Dr.九命猫 @ 2017-07-23 19:15:44
****呵呵****
by bh1234666 @ 2017-07-28 10:04:02
现在好像不会了,评测机改了
by bh1234666 @ 2017-07-28 10:20:34
@[baohan](/space/show?uid=48978) 然而依旧TLE..暴力过不了
by Accepted_233 @ 2017-08-13 14:12:44