版本比较
2.3考试复盘
正文
增加 8 行删除 8 行
1234567891037 行未改动48495051525354555657586 行未改动65666768697071727329 行未改动103104105106107108109110111141 行未改动全部展开## 1.[dfs01](https://www.luogu.com.cn/problem/T729137?contestId=307583)迷宫上搜索思想VS普通搜索思想迷宫上搜索:我得搞一个方向数组(看方向)普通搜索:我是不是要把迷宫都跑一遍?(看过程)所以这道题就用 迷宫上搜索 来解:- 你可以用一个桶数组来储存方向(更快捷)- 编不出来啊啊啊啊::::success[AC]37 行未改动::::## 2.[dfs02](https://www.luogu.com.cn/problem/T729139?contestId=307583)根本不用`bool vis[][]`,因为数字会承担一切也不用判断是否抵达终点,因为四周都比他大就不会运行了::::success[AC]````cpp line-numbers#include<bits/stdc++.h>using namespace std;6 行未改动int nx=x+dir[i][1],ny=y+dir[i][0];if(nx>m or nx<1 or ny>n or ny<1)continue;// cout<<ny<<' '<<nx<<'\t'<<high[ny][nx]<<'\n';if(high[ny][nx]<high[y][x])dfs(nx,ny,cnt+1);}}int main(){ios::sync_with_stdio(0);29 行未改动````cpp line-numbers#include<bits/stdc++.h>using namespace std;int horse[8][2]={{1,2},{-1,2},{2,-1},{2,1},{1,-2},{-1,-2},{-2,1},{-2,-1}};/*| | | |=|=| |=|=O*/141 行未改动全部展开1234567891037 行未改动48495051525354555657586 行未改动65666768697071727329 行未改动103104105106107108109110111141 行未改动全部展开## 1.[dfs01](https://www.luogu.com.cn/problem/T729137?contestId=307583)迷宫上搜索思想VS普通搜索思想迷宫上搜索:我得搞一个方向数组(看方向)普通搜索:我是不是要把迷宫都跑一遍?(看过程)所以这道题就用 迷宫上搜索 来解:- 你可以用一个桶数组来储存方向(更快捷)- 编不出来啊啊啊啊::::success[AC]37 行未改动::::## 2.[dfs02](https://www.luogu.com.cn/problem/T729139?contestId=307583)根本不用`bool vis[][]`,因为数字会承担一切也不用判断是否抵达终点,因为四周都比他大就不会运行了::::success[AC]````cpp line-numbers#include<bits/stdc++.h>using namespace std;6 行未改动int nx=x+dir[i][1],ny=y+dir[i][0];if(nx>m or nx<1 or ny>n or ny<1)continue;// cout<<ny<<' '<<nx<<'\t'<<high[ny][nx]<<'\n';if(high[ny][nx]<high[y][x])dfs(nx,ny,cnt+1);}}int main(){ios::sync_with_stdio(0);29 行未改动````cpp line-numbers#include<bits/stdc++.h>using namespace std;int horse[8][2]={{1,2},{-1,2},{2,-1},{2,1},{1,-2},{-1,-2},{-2,1},{-2,-1}};/*| | | |=|=| |=|=O*/141 行未改动全部展开