Holiday test 1-3

Day1

A. finger-guessing game

Meaning of the questions: mora, probabilistic decision known B, n innings to win more than one person to win the victory, m1 A more wins than the B final A round victory, and vice versa. A determination of probability under optimal decision final victory.
First B of the same decision each round, if we can find the probability of each round wins B can use Gaussian elimination out of the solution.
A probability of a win is provided to p, the probability of winning is B r.
Case found that draw a lot of trouble, but had no effect on the situation.
Modify a game is defined as the two sides continue the process until one side scores.
At this time, then the probability of a win A \ (Q \) is \ (\ frac {p} {
p + r} \) where targets are determined and maximize \ (Q \)
may be transformed \ (q = 1 - \ frac {1} {1+
\ frac {p} {r}} \) disposed \ (K = \ R & lt FRAC {P} {} \) , at this time the task is to find the largest k.
It does not directly ask, because this thing can not transfer.
Correct answer is 01 points plan, according to seek the right part of the equation.
Let t dichotomous answer, for the sake of conversion \ (max (pt * r)
\) defines a win 1 point A, B wins a loss of t points.
Similar expectations dp backwards to go back to.

Day2

A. center

The meaning of problems: there is no a point (the edge may be) to the figure, to minimize this point to the farthest node.
Can thirds, however check on the pre-exam to write ugly.
check: enumerate all nodes u, u take on both sides to take a whole min max.
However, some parameters will thirds WA, will not permit monotonic.

B. escape

Meaning of the questions: n seek no simple path to strict short-circuits Figure 1 ->.
There is no easy path to limit or twice to open the shortest stack enumeration side will do. . .
Violence analysis approach problem solution:
First, find a specific fixed-side direction and
enumerate a, b, from 1-> a and b-> n take the shortest (original shortest path must be on the road), a-> b away It does not contain any special edge of a shortest path.
Such enumerate all a, b will be able to find short-circuits.
However, direct enumeration would be too expensive, as previously done a color tree-like pressure DP, may wish to set point grouping, as long as the best ab belong to two groups, the answer is correct.
Feasibility of the packet is evident, two may be pretreated (note that only select the shortest "path"), for each b minimize dis (1-> a) + dis (a-> b), the initial value can be put a.
Binary groups can also be randomly assigned, once the correct rate is 0.75
with a few times on it, but this does not seem to really `positive solution (positive solution nor hair ...), the card also SPFA, barely able to live.

Day3

A. Colorado Potato Beetle

The meaning of problems: gives the n line segments, the line segment seek cover or surround area. n <= 1000, x <= 1000000
is not very cross half-plane, because a certain extent but is not required and intersection.
Part points violence bfs, if the discrete n ranges are also possible. <- positive solutions
but does not, a lot of details.
The two endpoints are discrete, attention should turn to the left and right to open and close.

B. Distinct Paths

The meaning of problems: n * m grid limits left to bottom right, a total of k colors, some initial color, no need to give a coating color grid coloring and ensure that all paths do not pass through the same two color grid, seek the number of programs. n, m <= 1000, k <= 10.
First, when n + m-1> k certainly no solution.
And n + m ranges from very small, so the search attempt.
Record current state reaches the color of each point of the set, by the way, when the search grid maintenance.
Plus optimal pruning limits of data more than seven seconds.
There is no limit the number of each color, then different colors for the first time painted the same answer.
So the seizure of one of the other direct plus on it.

Guess you like

Origin www.cnblogs.com/hzoi-yzh/p/12241549.html
1-3