0925- simulation game

A

Hit table, and one or two violent force Guo water of a water + lower_bound

B

This problem hey water, LCA plate title ah, alacrity alacrity

Then the code to achieve knock explode

First of all want more, you can do a lot of special judge sentenced a special, two cases of a writing I discuss, no reason to increase the amount of code does not say, but also do not know why a lot of weird errors,Finally, it only took a special sub-sub

And a very ghost knock on the wrong sides (the exam again and again revised) of the place:

scanf("%d%d",&x,&y);
if(x == y){
    ......
    printf("%d\n", n - size[x11] - size[y11]);
}

I wrote

scanf("%d%d",&x,&y);
if(x == y){
    ......
    printf("%d\n", size[lca] - size[x11] - size[y11]);
}

Knock on the test again manually simulated data sets his own making, had wanted to shoot, but less likely to write violence (floyd wrote blown up), finished violence and will not make data (tree Zezheng ah)

Finished seriously learn to shoot a wave

(Actually changed for a long time after the mistake or WA70 boss caught up visits, shivering learned how to build a tree + modification techniques for some weird error shoot at the boss's eyes)

C

There is one that one, not the amount of code in B flat major, the first wave of greed:

Obviously election outlier as far as possible (two point one side) out, let M elected to outliers right.

Enough selected ( \ (M \ Times 2> = K \) ) outputs \ ((K + 1) / 2 \)

Do not have enough points to how the rest of the points are even a point of an edge, then the answer is $ M + (K - M \ tims 2) == if $ \ (K - M \)

As for how to choose the largest isolated point, tree dp fucks:

dp [i] [0] represents the maximum number of points in the subtree rooted at i is capable of pairing two by two, it does not contain a node i.

dp [i] [1] represents a maximum number of points in the subtree rooted at i is capable of pairing two by two, the node comprising i.

Obviously dp [i] [1]> dp [i] [0]

Transfer equation:

dp [u] [0] = Σv u is the son dp [v] [1];

dp[u][1]=max(dp[u][1],dp[u][0]-dp[v][1]+dp[v][0]+2)。

M = dp[1][1]

Summary of a wave

Score desirable: \ (100 + 100 + 0 = 200 \)

Actual Score: \ (0 + 0 + 100 = 100 \)

Code force too bad, no comment

Guess you like

Origin www.cnblogs.com/qwqq/p/11621091.html