51 provincial election simulation

A. mathematics

With the present title particular properties can be obtained if the n-$ $ is odd, then the answer is $ (ab) ^ {\ frac {n + 1} {2}} $, this can be found at the square of stuff right.

For n-$ $ is an even number, all $ 2 $ can be extracted, and then to obtain a solution to the remaining part.

Then shrinking the number of $ 2 to $ iteration, when reduced to $ 2 ^ 0 $ when you can get a direct solution.

When the step is very subtle $ y_0 ^ {2 ^ w}! = -1 $, because $ y_0 ^ {2 ^ {w + 1}} = 1 $, there $ (y_0 ^ {2 ^ w} -1) * (y_0 ^ {2 ^ w} +1) = 1 $.

Can then, for the effect of the modulo two by decomposing the above value, to continue recursively.

 

B. irrigation

Every plank to be considered the greatest location, then each contribution is the new interval size, so obviously the idea is to maintain a range of about endpoints.

And then I found this thing is not necessary, we would only focus on a value exists.

For each embodiment, can optionally be constructed with endpoint left, right and left weights are independent of the endpoint, so long as the maintenance interval length on the line.

Write a dp, found that only 0/1 the weight, it corresponds to the displacement and transfer or operation, apparently to optimize the use bitset.

Just prefix and something similar overall complexity to achieve $ O (\ frac {n ^ 3l} {w}) $ a.

Found much smaller than the number of weights, the weights of each can be considered a do $ O (\ frac {n ^ 2l ^ 2} {w}) $.

 

C. C

Strange data range, only two together defining a particular quality factor, apparently prompted network flow.

However, this did not think can be assigned two point sets bipartite graph.

Groups denote two set points and the second group in the first prime number in the prime number in the group, the group size are $ p_1, p_2 $.

Delete leaves a bad deal, you can consider retaining the blades. So each group has been deleted blade where clearly illegal.

Each point corresponds to two groups, which is the edge of the bipartite graph, the two groups can not be reserved simultaneously.

Then the maximum independent set problem is bipartite graph, maximum independent set = Collection - Set maximum match.

Guess you like

Origin www.cnblogs.com/hzoi-cbx/p/12570744.html