AcWing模板:
# 将所有存在交集的区间合并
def merge(segs):
res = list()
segs.sort()
st, ed = -2e9, -2e9
for l, r in segs:
if ed < l:
if st != -2e9: res.append([st, ed
# 将所有存在交集的区间合并
def merge(segs):
res = list()
segs.sort()
st, ed = -2e9, -2e9
for l, r in segs:
if ed < l:
if st != -2e9: res.append([st, ed