EDITORIAL:
The metaphysics exam for some reason, mingled third rk1, 190pts on the OJ, the lemon 220pts, T1 fucks run 1600ms in random data, but the A lemon out, in fact, there may be other card data think the algorithm, this algorithm (specifically would say the following) ignored.
Intermediate value A.
label:
Recursion?
answer:
First talk about promiscuity on Venue: First, the ownership of discrete values, set f [0/1] [i] representative of a, b in the array is less than equal to the maximum position i
opt == 1 violence when modified, complexity of O (metaphysical), opt == 2 when O (log2 (n)) bipartite + O (1) check, by this question, the card is often able to live OJ
Positive solutions very clever, when the query interval k-th largest, the k binary assigned to a [0/1] two arrays,
Compare the size of the binary end position of each of two recursive array to determine the direction, since each binary k, the complexity is O (mlog2 (n))
B. minimum
label:
Data structure optimization Dp
answer:
According to conventional routine set dp [i] i mean the end of the maximum benefit
dp[i]=max{dp[j]+calc(min(a[j+1]~a[i]))}
Consider maintaining minimum dp [i] and a minimum value dp [i] + calc segment tree with
Each time interval corresponding to change the assignment min into a [i], using min {dp [i]} Update min {dp [i] + calc} to
C. maximum
label:
Expected + segment tree
answer:
Obviously I will not