如果你想用 map 水过,那么,请你在找当前 (l,r)(l,r)(l,r) 有没有算过时用一下代码:
ans.find({l, r}) != ans.end()
如果你直接调用 ans[{l,r}] 他每次创建一个新的就爆了。
ans[{l,r}]