Reflection Summary (inverted continuously updated

  Lifetime series  

csp-s analog test 502019-09-22


T1 blow open a small residual brain array 20, T2 violence violence points up to standard, T3 anencephaly $ n ^ 5 $ get violent 20 is ( CNM living violence

T2 has not changed over (after all, I was a little control block boycott Mo team but elegant violence, a pro-ah Hey I heard Mo teams do not block, first muttered change tomorrow

 A. Construction

   The main proof of that is not filled ......

  $ F [i] $ $ I $ denotes taking into account and $ I $ constant height position of the minimum cost

  So very good write transfer equation $ f [i] = \ sum_ {k = j + 1} ^ {i-1} (t-h_k) ^ {2} + c * (h_j + h_i-2 * t) + f [j] $

  But there is a detailed answer than $ f [n] $ you need to put a non-high pillars around the last imaginary seeking $ f [n + 1] $

  It represents the transition from $ i $ $ j $ over, what we want to be transferred to the $ j $ $ i $

  Must be $ j <= i $ and for any $ j + 1 <= k <= i-1 $ has $ h [k] <= h [i] $ $ and $ $ h [k] <= h [j] $

  (Ah because obviously you want $ i, j $ between all filled up

  We can think about how to maintain the transfer of $ j $ if we find a set of enumeration, then make the complexity of the "optimized" to $ O (n ^ 2) $

  So we decadent complete solution to a problem selecting the monotony stack

  Think Why monotonous stack

  

  We maintain a monotonically decreasing monotonous stack $ l $, $ j $, $ k $ elements of the stack is monotonous (monotonically stack memory subscript like the original sequence

  Then the actual meaning monotonous stack between $ l $, $ j $ no more than $ h [l] $, $ h [j] $ large elements

  It means that your $ l $, $ j $ can be transferred to the $ i $

  And when $ I $ push it off the top (as in FIG. $ J $, $ k $) will not be transferred to the latter element $ I $

  In fact, it is clear that there is a record $ r $ needs to be updated in mind after the transfer point for the $ pos $ i $ $ you must meet the above-said

  Between $ l $, $ j $ no more than $ h [l] $, $ h [j] $ large elements

  Similarly here also should not have large elements than $ $ h [pos] $, $ h [r] between $ pos $, $ r $

  So we want to be top off the $ i $ $ k $ is obviously not possible because there is a transfer point between a $ i $ k $ and $ r $ $ $ k $ can not make as $ pos $

  It's monotonous stack of excellence and correctness ( delete unnecessary transfer point, and delete operations are right

 

  Transfer point monotonous stack maintenance discussion is over, we think the transfer

  How we think it should be transferred to a transfer of $ j $ to $ i $ A Case Study

  We need to do is to fill between $ j + 1 $ to $ i-1 $

  Like the meaning of this array must be $ j $, $ i $ not move then it can reach into consideration J $ $ $ and $ J Fixed minimum cost $ f [j] $ and filled $ j + 1 $ to $ i-1 $ cost

  I.e. transfer equation origin $ f [i] = \ sum_ {k = j + 1} ^ {i-1} (t-h_k) ^ {2} + c * (h_j + h_i-2 * t) + f [ j] $

   Now we have to do is find a $ t $ is obviously the best result in the form of a quadratic function

  Suppose we have the lowest point of the quadratic function corresponding to $ t $

  We think even on the college entrance math you have to ensure that the independent variable $ t $ realistic

  Then we do the $ t $

  <= I-1 $ large than some $ h [i] $, $ h [j] $ and less than $ max (h [k]) $, $ j + 1 <= k

  That is to seek out the best (not necessarily realistic) set limit of $ t $

  Obviously for the last $ h [i] $, $ h [j] $ take $ min $, for $ max (h [k]) $ take $ $ like max

  $ h [i] $, $ h [j] $ known, that $ max (h [k]) $ it?

  想想单调栈 记栈顶为$top$

  显然$i$和$top-1$之间的最大值是$h[top]$

  所以可以每次在弹栈前进行修改

  以$top-1$为$j$,$h[top]$为$max(h[k])$更新答案    然后把$top$弹走  这时我们是不用考虑$top-1$的

  

  关于$t$的求法   就是二次函数最低点$-b/2a$

  把原始方程化为$a*t^2+b*t+c$的形式 求出$t$ 并如上设限带入求值就好

   $t=-\tfrac{b}{2a}=\tfrac{\sum_{k=j+1}^{i-1}h_k+c}{(i-1-j)}$

  注意边界问题 在我们假象的柱子上是不用付出代价的(比如你当前要转移到$n+1$  把之前的填为$t$ 是不需要付出$(h[n+1]-t)*c$的代价的)

 

  大体就是这样 但是证明为什么是平的我只能YY

 


 B. 蔬菜

  我正在打莫队


 

 C. 联盟

  $O(n^5)$暴力有人听吗?


 

Guess you like

Origin www.cnblogs.com/bilibiliSmily/p/11569469.html