思路 判断连通块的个数,直接用dfs(), 把连通块全部标记为访问过,枚举从某个点出发 坑点,如果我们从宝藏的进入dfs(),宝藏应该提前判断 #include <bits/stdc++.h> //#define int long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; using namespace std; string g[N]; string st[N]; int n, m, ff; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; void ...