1class Solution:2def twoCitySchedCost(self, costs: List[List[int]]) -> int:3n = len(costs)4m = n // 256@lru_cache(None)7def dfs(cur, a):8# cur is the current user index9# `a` is the number of people travel to city `a`1011if cur == n:12return 01314# people to b city15b = cur - a16ans = float("inf")1718# the number of people to `a` city number did not reach to limit,19# then current user can trval to city `a`2021if a < m:22ans = min(dfs(cur + 1, a + 1) + costs[cur][0], ans)2324# the number of people to `b` city number did not reach to limit25# then current user can trval to city `b`26if b < m:27ans = min(dfs(cur + 1, a) + costs[cur][1], ans)2829return ans3031return dfs(0, 0)