zoukankan      html  css  js  c++  java
  • poj 1088 滑雪

    #include<cstdio>
    #include<cstring>
    #include<cmath>
    #include<algorithm>
    using namespace std;
    int mapp[111][111];
    int uu[111][111];
    struct abc{ int x, y, hh; } node[111 * 111];
    bool cmp(const abc&a, const abc&b) { return a.hh > b.hh; }
    int dir[4][2] = { { -1, 0 }, { 1, 0 }, { 0, -1 }, { 0, 1 } };
    int main()
    {
        int m, n, i, j, k;
        while (~scanf("%d%d", &n, &m))
        {
            int tot = 0;
            for (i = 1; i <= n; i++) for (j = 1; j <= m; j++) scanf("%d", &mapp[i][j]);
            for (i = 1; i <= n; i++)
            {
                for (j = 1; j <= m; j++)
                {
                    node[tot].x = i;
                    node[tot].y = j;
                    node[tot].hh = mapp[i][j];
                    tot++;
                }
            }
            sort(node, node + tot, cmp);
            memset(uu, 0, sizeof(uu));
            for (i = 0; i < tot; i++)
            {
                for (k = 0; k < 4; k++)
                {
                    int xx = node[i].x + dir[k][0];
                    int yy = node[i].y + dir[k][1];
                    if (xx >= 1 && xx <= n&&yy >= 1 && yy <= m)
                    if (uu[node[i].x][node[i].y] + 1>uu[xx][yy])
                    if (mapp[node[i].x][node[i].y]>mapp[xx][yy])
                        uu[xx][yy] = uu[node[i].x][node[i].y] + 1;
                }
            }
            int anss = -1;
            for (i = 1; i <= n; i++)
            for (j = 1; j <= m; j++)
            if (uu[i][j] > anss) anss = uu[i][j];
            printf("%d
    ", anss + 1);
        }
        return 0;
    }
  • 相关阅读:
    JVM classloader
    面试整理
    工具配置链接
    IntelliJ IDEA 热部署
    IntelliJ IDEA 常用快捷键
    类文件结构
    判断对象存活的方法
    JVM 运行时数据区域
    vim编辑16进制
    阿里云yum源
  • 原文地址:https://www.cnblogs.com/zufezzt/p/4509872.html
Copyright © 2011-2022 走看看