lanqiao 19712 数字接龙

This commit is contained in:
2025-04-11 09:33:51 +08:00
parent 01e55f3cf7
commit 1388ed8187

View File

@@ -30,7 +30,7 @@ void dfs(int x, int y, int pre, string s, int dep){
vis[bx][by] = 1;
dfs(bx, by, a[bx][by], s + to_string(i), dep + 1);
// 最优性剪枝
// 最优性剪枝, 已经找到了一个可行序列, 不必再往后搜索
if(!res.empty()) return;
vis[bx][by] = 0; //回溯
}