为什么把
ans+=T.query(root[u],root[lca],1,q,1,w); ans+=T.query(root[v],root[fa[lca]],1,q,1,w);
改成
ans+=T.query(root[u],root[fa[lca]],1,q,1,w); ans+=T.query(root[v],root[fa[lca]],1,q,1,w); if(val[lca]<=w) ans--;
就错了
完整代码
这不算tlqtj吧