2
def maxStudents(self, seats: List[List[str]]) -> int:3
m, n = len(seats), len(seats[0])4
match = [[-1] * n for _ in range(m)]6
def dfs(i, j, visited):18
and seats[x][y] == "."19
and (x, y) not in visited22
if match[x][y] == -1 or dfs(*match[x][y], visited):31
for j in range(0, n, 2):32
if seats[i][j] == "." and match[i][j] == -1:34
cnt += dfs(i, j, visited)37
# returns the number of elements of the maximum independent set in the bipartite set39
sum(seats[i][j] == "." for i in range(m) for j in range(n)) - max_matching()