Problem 3480 · Hard

Maximize Subarrays After Removing One Conflicting Pair

The array holds 1 through n, and some value pairs conflict. Discard exactly one pair, count the non-empty subarrays that contain no remaining pair in full, and return the largest count over all choices of discarded pair.

Open the interactive visualisation