no name

Subject:
https://ac.nowcoder.com/acm/problem/14532

Each population has NNN different individuals form a circle and grow every other unit time.
In a unit time, each individual will radiate energy to both sides, the radiation range and intensity are bothKKK , the radiation intensity will decrease as the distance increases, and the distance increases by1 11 Radiation intensity decreased1 11. The energy received through radiation in this unit time will be retained, and the initial energy will be consumed. For two individualsaaa b b b , whereaaa tobbThe radiation of b will makebbb increase [radiation intensity× a × a× a the initial energy value]. The overall change can be expressed as
ai ′ = ∑ j = 1 n [K − dis (i, j)> 0] [i ≠ j] (K − dis (i, j)) a [j] a_i^{') =\sum_{j=1}^{n}[K-dis(i,j)>0][i\neq j](K-dis(i,j))a[j]ai=j=1n[Kd i s ( i ,j)>0][i=j](Kd i s ( i ,j))a[j]

Idea: It
can be found that this is a linear transformation, and the coefficients are all determined.
A [a 1 a 2.. An] = [a 1 ′ a 2 ′.. An ′] \boldsymbol A\begin{bmatrix}a_1\\a_2\\.\\.\\a_n\end{bmatrix}= \begin{bmatrix}a_1^{'}\\a_2^{'}\\.\\.\\a_n^{'}\end{bmatrix}Aa1a2..an=a1a2..an
A \ boldsymbol A A is an ∗ nn*nnThe matrix of n is determined by the question formula. But this matrix multiplication isO (n 4) O(n^4)O ( n4 ), you will find that each row of this matrix is ​​cyclic, and the multiplication of two circulant matrices is still a circulant matrix, so you only need to calculate the first row for each calculation, and the next few rows are obtained through the cycle.

Guess you like

Origin blog.csdn.net/qq_43520313/article/details/108831393