self.m, self.n = 0, 0 # 压缩状态的定义 self.masks = {} # 记录每一个状态的三进制表示 self.truncate = {} # 下一位的三种情况 def getMaxGridHappiness(self, m: int, n: int, introvertsCount: int, extrovertsCount: int) -> int: self.m, self.n = m, n # 预处理状态压缩的情况 ...