如果你认为你的搜索代码是正确的,且你的搜索代码中有这么一句话:
for(int i = 0;i < n;i++) sort(h[i].begin(),h[i].end());
请将它改成:
for(int i = 0;i <= n;i++) sort(h[i].begin(),h[i].end());
因为节点n也要被遍历。