Problem 3117 · Hard

Minimum Sum of Values by Dividing Array

Split the array into pieces whose ANDs match the target values, paying each piece its last element, and keep the cheapest split.

Open the interactive visualisation