可能是你的排序出了问题 我就这么错的,正确的排序应该为
bool cmp(const query &x, const query &y) { if (pos[x.x] == pos[y.x]) { if (pos[x.y] == pos[y.y]) return x.pre < y.pre; else return x.y < y.y; } return pos[x.x] < pos[y.x]; }
其中 pos[x]pos[x]pos[x] 表示 xxx 属于的块号