Problem 3836 · Hard

Maximum Score Using Exactly K Pairs

Choose k matched index pairs that increase in both arrays, using a layered table over prefixes of the two arrays.

Open the interactive visualisation