本地运行和洛谷的差距!

P1434 [SHOI2002] 滑雪

史强 @ 2019-12-28 10:02:47

代码:

#include <bits/stdc++.h>
using namespace std;

int n,m;

int mp[105][105];

int f[105][105];

int dx[4]={0,0,1,-1};
int dy[4]={1,-1,0,0};

int dfs(int x,int y)
{
    if(f[x][y])return f[x][y];
    f[x][y]=1;
    for(int i=0;i<4;i++)
    {
        int xx=x+dx[i];
        int yy=y+dy[i];
        if(xx>0&&yy>0&&xx<=n&&yy<=m&&
        mp[x][y]>mp[xx][yy])
        {
            dfs(xx,yy);
            f[x][y]=max(f[x][y],f[xx][yy]+1);
        }
    }
    return f[x][y];
}

int main()
{
    cin>>n>>m;

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            cin>>mp[i][j];
        }
    }

    int ans=0;

    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=m;j++)
        {
            ans=max(ans,dfs(i,j));
        }
    }

    cout<<ans<<endl;

    return 0;
}

样例: in:

5 5

1 2 3 4 5

16 17 18 19 6

15 24 25 20 7

14 23 22 21 8

13 12 11 10 9

out:

25

本地:out: 9

???

洛谷 :

测试点信息

3ms/648.00KB AC

1

Accepted, 得分 10. ok accepted 5ms/812.00KB AC

2

Accepted, 得分 10. ok accepted 4ms/924.00KB AC

3

Accepted, 得分 10. ok accepted 3ms/508.00KB AC

4

Accepted, 得分 10. ok accepted 3ms/640.00KB AC

5

Accepted, 得分 10. ok accepted 2ms/696.00KB AC

6

Accepted, 得分 10. ok accepted 4ms/644.00KB AC

7

Accepted, 得分 10. ok accepted 3ms/508.00KB AC

8

Accepted, 得分 10. ok accepted 4ms/672.00KB AC

9

Accepted, 得分 10. ok accepted 4ms/784.00KB AC

10

Accepted, 得分 10. ok accepted 4ms/784.00KB AC

what?

What happened?


by 史强 @ 2019-12-28 10:03:17

咋100了?


by Mr_Greeper @ 2019-12-28 10:04:08

玄学问题


by Lithium_Chestnut @ 2019-12-28 10:08:16

@史强 luogu评测机卡常了。。。


by Most_Goodlooking @ 2019-12-28 10:18:24

={}!


by lu_fish @ 2019-12-28 10:37:09

qiang


|