Loading docs/search/backtracking.md +72 −68 Original line number Diff line number Diff line Loading @@ -42,9 +42,13 @@ void eq(int line) if((!check[0][i]) && (!check[1][line + i]) && (!check[2][line - i + n])) { ans[line] = i; check[0][i]=1; check[1][line+i]=1; check[2][line-i+n]=1; check[0][i] = 1; check[1][line + i] = 1; check[2][line - i + n] = 1; eq(line + 1); check[0][i]=0; check[1][line+i]=0; check[2][line-i+n]=0; check[0][i] = 0; check[1][line + i] = 0; check[2][line - i + n] = 0; } } } Loading @@ -66,7 +70,8 @@ using namespace std; int n, m, k, x, y, a, b, ans; int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0}; bool vis[6][6]; struct oo{ struct oo { int x, y, used[6][6]; }; Loading Loading @@ -117,4 +122,3 @@ int main() return 0; } ``` Loading
docs/search/backtracking.md +72 −68 Original line number Diff line number Diff line Loading @@ -42,9 +42,13 @@ void eq(int line) if((!check[0][i]) && (!check[1][line + i]) && (!check[2][line - i + n])) { ans[line] = i; check[0][i]=1; check[1][line+i]=1; check[2][line-i+n]=1; check[0][i] = 1; check[1][line + i] = 1; check[2][line - i + n] = 1; eq(line + 1); check[0][i]=0; check[1][line+i]=0; check[2][line-i+n]=0; check[0][i] = 0; check[1][line + i] = 0; check[2][line - i + n] = 0; } } } Loading @@ -66,7 +70,8 @@ using namespace std; int n, m, k, x, y, a, b, ans; int dx[4] = {0, 0, 1, -1}, dy[4] = {1, -1, 0, 0}; bool vis[6][6]; struct oo{ struct oo { int x, y, used[6][6]; }; Loading Loading @@ -117,4 +122,3 @@ int main() return 0; } ```