2019 Hunan tournament title H - transition probability matrix inverse &&

The meaning of problems

Topic Link

Bobo has a $ n + m $ directed graph nodes, numbered as $ 1 \ sim n $, he had a n-$ $ $ n + m $ row-column matrix $ P $.

If the $ t $ time he is located between node $ u (1 \ leq u \ leq n) $, then $ (t + 1) $ time he probability nodes $ V $ in as $ P_ {u, v} / 10000 $;

If it is located in time $ t $ node $ u (u> n) $, then $ (t + 1) $ u $ of his moment in the probability of a node is $ 1.

Node 0 is located 1 Bobo time, long after the endless seeking, which is located in node $ (n + 1), (n + 2), ..., (n + m) $ probability.

analysis

Demand situation infinitely long, or into the circulation, either with the same geometric series sum is converged to a number, the total can not simulate it step by step.

Routine wave, vectors $ D_i = (d_1, d_2, ..., d_ {n + m}) $ $ i represents the probability of moving at various points after $ times.

Easy to know, $ d_1 = d_1 * P_ {1,1} + d_2 * P_ {2,1} + .. + d_ {n + m} * P_ {n + m, 1} $, $ Similarly available D_2 , d_3, .., d_ {n + m} $, such a transfer can be written in matrix form

The output of the n-$ $ $ n + m $ rows columns, according to the meaning of problems, can fill all 0 at the lower left, the lower right patch matrix, the matrix obtained X-$ $,

The $ D_n = D_ {n-1} * X, \ D_1 = (1, 0, 0, ..., 0) $.

I.e., $ D_n = D_0 * X ^ n $.

Knowledge of the block matrix, the X-$ 4 $ written submatrices: the upper left corner (n * n) part A, the upper right corner (n * m) portion is B, the lower left corner (m * n) is a zero matrix portions, lower right corner of (m * m) is a part of a unit matrix E:

$$x = \begin{bmatrix}
A & B\\
0 & E
\end{bmatrix}$$

The math is easy to find:

$$x^n = \begin{bmatrix}
A^n & (B+AB+...+A^{n-1}B)\\
0 & E
\end{bmatrix}$$

When $ n $ tends to infinity, the actual significance, $ A ^ n = 0 $.

The geometric series summation formula to obtain:

$$B+AB+...+A^{n-1}B = \frac{E-A^n}{E-A}*B$$

Because the $ n $ tends to infinity, so

$$\frac{E-A^n}{E-A}*B = \frac{E}{E-A} *B = (E-A)^{-1}*B$$

Using Gaussian elimination, O (n ^ 3) to give the complexity of the inverse matrix.

This is obtained when $ n $ modulo infinity $ X ^ n $ value and $ D_0 $ multiplied to get the answer.

 

 

Reference Links: https://blog.csdn.net/qq_43202683/article/details/100170570

 

Guess you like

Origin www.cnblogs.com/lfri/p/11628553.html