def __next__(self):
if not self._pq:
raise StopIteration
pair = heapq.heappop(self._pq)
t = pair.x
for i in range(self._n):
v = t[i] + 1
tp = t[:i] + (v,) + t[i + 1:]
if v > self.max_sizes[i]:
if i not in self.continuation:
self.continuation[i] = tp
continue
if tp not in self._memo:
pair = PairGen._Pair(*tp)
heapq.heappush(self._pq, pair)
self._memo[tp] = True
return t
评论列表
文章目录