import json values = [(1, 5), (2, 3), (3, 4), (4, 1), (4, 6)] front = [] for index, target in enumerate(values, start=1): # 更小更好;至少一列严格更小,才能称为支配。 dominated = any( all(a <= b for a, b in zip(other, target)) and any(a < b for a, b in zip(other, target)) for other in values ) if not dominated: front.append(index) assert front == [1, 2, 4] result = {"front_rows": front} print("LAB_RESULT " + json.dumps(result, ensure_ascii=False))