Code Library Of Others/sgtlaugh/HLD + RMQ On Edges.cpp
int query_tree(int u, int l){ /// hash = 486879
        int res = NIL;
        while (height[u] > height[l]){
            if (num[u]){
                int v = jump(u);
                if (height[v] <= height[l]) v = down[l];
                res = OPT(res, query_rmq(1, 1, id, num[v], num[u]));
                u = parent[v];
            }
            else res = OPT(nodeval[u], res), u = parent[u];
        }
        return res;
    }
/// Sum of all edges in the path from u to l, l must be an ancestor of u
Sum of all edges in the path from u to l, l must be an ancestor of u
Sum of all edges in the path from u to l l must be an ancestor of u
int query_tree(int u, int l){ 
        int res = NIL;
        while (height[u] > height[l]){
            if (num[u]){
                int v = jump(u);
                if (height[v] <= height[l]) v = down[l];
                res = OPT(res, query_rmq(1, 1, id, num[v], num[u]));
                u = parent[v];
            }
            else res = OPT(nodeval[u], res), u = parent[u];
        }
        return res;
    }
int query_tree ( int u , int l ) { int res = NIL ; while ( height [ u ] > height [ l ] ) { if ( num [ u ] ) { int v = jump ( u ) ; if ( height [ v ] <= height [ l ] ) v = down [ l ] ; res = OPT ( res , query_rmq ( 1 , 1 , id , num [ v ] , num [ u ] ) ) ; u = parent [ v ] ; } else res = OPT ( nodeval [ u ] , res ) , u = parent [ u ] ; } return res ; }
Sum of all edges in the path from u to l, l must be an ancestor of u
Sum of all edges in the path from u to l l must be an ancestor of u
/// hash = 486879