private void setInvalidPos(int[][] visited, int i, int j) {
        for (int t = 0; t < visited.length; t++) {
            if (visited[i][t] == 0) {
                visited[i][t] = -1;
            }
            if (visited[t][j] == 0) {
                visited[t][j] = -1;
            }
        }
        for (int t = 0; t < visited.length; t++) {
            for (int s = 0; s < visited.length; s++) {
                if (visited[t][s] == 0 && (t - s == i - j || t + s == i + j)) {
                    visited[t][s] = -1;
                }
            }
        }
    }