Problem 1617 · Hard

Count Subtrees With Max Distance Between Cities

Enumerate every subset of cities, keep the connected ones, and count each subtree by its largest pairwise distance.

Open the interactive visualisation