63 exam simulation summary

Exam problems encountered:

It did not state a half-day exam T1 tune nth_element, but not remember the complexity,

Then found nth_element (a + l, a + k, a + r), where k represents [l, r] k-th element of small and l! = 1 when k + l-1 to be

Later it was found to pay up a number of issues the following code:

1. wire mesh wrong, it should be if (v [i] <prm [j]) break;

2.s1, s2 array open to 1e8. . .

3. The post code is not deleted debugging

T2 stem that problem? Although a lot of people see it did not say get abs

 

T1 pit

 

T2

An apparently greedy, the more hesitant the examination room, everyone get the current maximum, otherwise the same chance, let rivals get bigger

So consider how to maintain? $ O (kn) $ is possible

Then each can open buckets, and each maximum value and each record  the while (T [MX]!) - MX;    course discretization

T3

I want to go to the examination room a bit more to prove whether the traveler is to get less

Every traveler throwing food operations will make it point right after the increase, it will only make the latter more

Consider dp

The definition of f [i] [j] represents a point from a sub-tree of i to i planted a contribution of crumbs of j

The definition of g [i] [j] denote the i sub-tree to a point j sprinkled bread crumbs contribution

Transfer f [x] [j] = max {g [y] [j-1] + sum [x] -a [y]} sum [x] for all points x and connected to the right point, the extra contribution was to sum [x] -a [y]

g [x] [j] = max (g [y] [j-1] + sum [x] -a [fa]) Why -a [fa] consider ans ultimately contribute to?:

ans = max (ans, f [x] [j] + g [x] [Vj]) by subtracting both the fa must be a splice point x

For each point dp run positive and negative sides: the first pass corresponds to a left to right direction in accordance with a dp value sequentially updated spliced ​​out of the x

Another direction should be taken into account

Guess you like

Origin www.cnblogs.com/casun547/p/11635766.html