版本比较
P6845 题解
正文
增加 3 行删除 3 行
41 行未改动424344454646474849506 行未改动5758596061616263646549 行未改动1151161171181191191201211221234 行未改动41 行未改动 continue; } dis[y] = dis[x] + w; dfs(y,x); dfn[++tot] = x; dfn[++tot] = x; } r[x] = tot;}void up(int x){6 行未改动void build(int x,int l,int r){ if(l == r){ int now = dis[dfn[l]]; s[x] = {now,now,-now,-now,0}; return ; return ; } build(ls,l,mid); build(rs,mid + 1,r); up(x);49 行未改动 int now; if(dep[e[x].x] < dep[e[x].y]){ now = e[x].y; }else{ now = e[x].x; now = e[x].x; } modify(1,1,tot,l[now],r[now],y - e[x].w); e[x].w = y; ans = s[1].abc;4 行未改动