求助为什么一直超时啊
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,x=1,y=0;
cin>>a;
int s[20][20];
int m=1;
while(m<=a*a)
{
while(y<a&&!s[x][y+1])
s[x][++y]=m++;
while(x<a&&!s[x+1][y])
s[++x][y]=m++;
while(y>1&&!s[x][y-1])
s[x][--y]=m++;
while(x>1&&!s[x-1][y])
s[--x][y]=m++;
}
for(int i=1;i<=a;i++)
{
for (int j=1;j<=a;j++)
cout<<setw(3)<<s[i][j];
cout<<endl;
}
return 0;
}