| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
圣母玛利亚 啊 !!!各种大神啊 我的为什么就 TLE#include<iostream>
using namespace std;
int ans=1;
int map[120][120];
int F,R;
typedef struct
{
int x;
int y;
} Way;
Way way[4]={{0,1},{0,-1},{1,0},{-1,0}};
int temp;
void solve (int x,int y)
{
int i;
for(i=0;i<4;i++)
{
if(x+way[i].x>=1 && y+way[i].y>=1 && x+way[i].x<=F && y+way[i].y<=R && map[x][y]>map[x+way[i].x][y+way[i].y])
{
temp++;
if(ans<temp) ans=temp;
solve(x+way[i].x ,y+way[i].y);
temp--;
}
}
}
int main()
{
cin>>F>>R;
int i,j;
for(i=1;i<=F;i++)
for(j=1;j<=R;j++)
scanf("%d",&map[i][j]);
for(i=1;i<=F;i++)
for(j=1;j<=R;j++)
{
temp=1;
solve(i,j);
}
cout<<ans<<endl;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator