[10.23] CPS-S2019 simulation game summary

Disclaimer: This article is a blogger original article, follow the CC 4.0 BY-SA copyright agreement, reproduced, please attach the original source link and this statement.
This link: https://blog.csdn.net/qq_43649416/article/details/102743696

I too hard

Game ideas

Portal

  • T1: Because obviously you n n side, so n 2 enumeration wave, then the answer is found to contribute to a continuous range segment and, like twice the difference.
  • T2: Random Walk? ? ? Shoved a wave of random walk formula relies entirely on yy, correctness apparently did not, so I did not play. Then found that the direct Gaussian elimination 60 minutes.
  • T3: meaning of the questions did not understand. . .

After the game digestion

  • T1 open a small array of gg.
  • T2 at constant optimization on the n- 3 water passed (without a dream I do not deserve to get more than 40 points). From the leaves up backwards like Gaussian elimination, because i disappear with the j, i have no son, leaving only the position of the father and grandfather has a value of i on the i-related, and j of the two positions there is also a certain value, so when the father does not eliminate some more position changes from 0 to something else. Time complexity and accuracy can be guaranteed.
  • In fact there nlogn T2 practice.
  • T3, is actually seeking a maximum of d, such that
    i d w i S = d , S = w i \sum \frac {|i-d|*w_i} {S} =d,S=\sum w_i
    Then suppose f ( d ) = i d w i d S f(d)=\sum {|i-d|*w_i}-d*S , to such f ( d ) = 0 f(d)=0
    found that this is a monotonically decreasing function because if d becomes large, the increment is smaller than the latter in front.
    Binary integer before looking for zero maintenance and use Fenwick tree can be found.
    And then a solution of the equation just fine.

to sum up

  • Be sure to check the size of the array.
  • Observe the nature of the subject, the desired title Gaussian elimination really is the most conventional way of routine.
  • T3 except that Italy is a water problem. . . But I was wrong character tone for two days. . . Mentality collapse.

Guess you like

Origin blog.csdn.net/qq_43649416/article/details/102743696