求助大佬,70分

P1434 [SHOI2002] 滑雪

希望更丰富的展现?使用Markdown
by ferrum_cccp @ 2019-04-16 17:50:10


希望更丰富的展现?使用Markdown
by yu__xuan @ 2019-04-16 17:50:26


救火: ```cpp #include <bits / stdc++.h> using namespace std; int R, C, map1[110][110], map2[110][110], Max1 = 0, jl = 0; void DFS(int x, int y) { if (x < 1 || x > R || y < 1 || y > C) return; if (map1[x + 1][y] < map1[x][y]) { if (map2[x + 1][y] != 0) { map2[x][y] = max(map2[x][y], 1 + map2[x + 1][y]); } else DFS(x + 1, y); } if (map1[x][y + 1] < map1[x][y]) { if (map2[x][y + 1] != 0) { map2[x][y] = max(map2[x][y], 1 + map2[x][y + 1]); } else DFS(x, y + 1); } if (map1[x - 1][y] < map1[x][y]) { if (map2[x - 1][y] != 0) { map2[x][y] = max(map2[x][y], 1 + map2[x - 1][y]); } else DFS(x - 1, y); } if (map1[x][y - 1] < map1[x][y]) { if (map2[x][y - 1] != 0) { map2[x][y] = max(map2[x][y], 1 + map2[x][y - 1]); } else DFS(x, y - 1); } jl++; map2[x][y] = max(map2[x][y], jl); jl = max(map2[x][y], jl); } int main() { scanf("%d%d", &R, &C); for (int i = 1; i <= R; i++) for (int j = 1; j <= C; j++) scanf("%d", &map1[i][j]); for (int i = 1; i <= R; i++) for (int j = 1; j <= C; j++) { DFS(i, j); Max1 = max(Max1, jl); jl = 0; } printf("%d", Max1); return 0; } ``` 不谢
by Jelly_Goat @ 2019-04-16 17:55:17


|