zhiyangfan @ 2021-11-01 15:56:03
倒也不需要把题解整个翻译一下 (我觉得也没人愿意这么干)
就是大概解释一下题解在说些啥,实在是没看懂他说的,谢谢各位神们qwq
Let’s now consider any consecutive segment of
K s (bounded by ends of the permutation or by K−1s). LetL be the element to the left end of this segment, or0 if there isn’t any, andR be the element to the right of this segment, orN+1 if there isn’t any. Clearly, no element from this segment that doesn’t lie in[L+1,R−1] can ever be in any longest increasing subsequence of P, so let’s consider only elements from this range. Denote themQ_1,Q_2,\cdot\cdot\cdot,Q_M , and denote the length of the longest increasing subsequence of Q asK_1 It’s easy to see that
K is equal to the number ofi withA_i=K-1 , plus the sum ofK_1 over all these segments. Indeed, we have to take alli withA_i=K-1 to every LIS, and the maximum number of elements that we can fit “in between” two such adjacentK-1 s (or ends) is precisely the correspondingK_1 .
从这两段开始看不懂的qwq 尤其是那个 segment 不知道干啥的