|
|
back to boardBetter algorithm Use heavy-light decomposition: after O(N) preprocessing, every tree path becomes O(log N) contiguous ranges in the HLD order. Because cave radiation only increases, maintain range maximums with a monotone Fenwick tree, giving O(log N) per update and O(log^2 N) per path query with O(N) memory. Current #1 AC Edited by author 06.06.2026 21:24 Edited by author 06.06.2026 21:24 |
|
|