在这道题不要用 vector<int> ans[N]。申请空间会 TLE。要用 vector<vector<int>> 因为你其实用不到 N 就不用往后开了。
vector<int> ans[N]
vector<vector<int>>
N