Solving CodeForces 258E with Multiple Data Structure Approaches

This problem asks for the number of nodes not covered by any of the unioned subtrees after a sequence of operations. Each operation selects two nodes a and b, then marks all nodes in subtree(a) ∪ subtree(b). For each node v, we must compute how many operations affect it — i.e., how many times v appears in such unions — and finally output n − (n ...

Sat, 09 May 2026 23:34:14 +0900 投稿