Skip to content

Commit 77bf5db

Browse files
committed
优化
1 parent 827f1a1 commit 77bf5db

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

main/1100-1199/1110F.go

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -121,22 +121,11 @@ func cf1110F(_r io.Reader, _w io.Writer) {
121121
}
122122
for _, e := range g[v] {
123123
p := nodes[e.to]
124-
l, r := p.l, p.r
125-
if l > 1 {
126-
t.update(1, 1, l-1, e.wt)
127-
}
128-
t.update(1, l, r, -e.wt)
129-
if r < n {
130-
t.update(1, r+1, n, e.wt)
131-
}
124+
t.update(1, 1, n, e.wt)
125+
t.update(1, p.l, p.r, -e.wt*2)
132126
f(e.to)
133-
if l > 1 {
134-
t.update(1, 1, l-1, -e.wt)
135-
}
136-
t.update(1, l, r, e.wt)
137-
if r < n {
138-
t.update(1, r+1, n, -e.wt)
139-
}
127+
t.update(1, 1, n, -e.wt)
128+
t.update(1, p.l, p.r, e.wt*2)
140129
}
141130
}
142131
f(0)

0 commit comments

Comments
 (0)