csp-s Analog 44

T1:
Consider gcd change up to log times, direct enumeration left point, the right-half gcd same point, greedy to find the longest.
T2:
analysis showed that only two conditions may make the minimum cost:
1. The maximum and minimum values of the same color
2. The maximum and minimum color different from
the second case, only greedy dyed to a large value in each group a color to
the first case, the minimum value of the enumeration of another color, so that the maximum value of minimum greedy to
T3:
design f [i] [j], i represents the processing operations prior to completion, a further pointer j minimum cost in the
segment tree can be optimized transfer

Guess you like

Origin www.cnblogs.com/Gkeng/p/11788287.html