Problem 3017 · Hard

Count the Number of Houses at a Certain Distance II

Houses sit on a line with one extra cable between two houses; count ordered pairs at each shortest distance.

Open the interactive visualisation