CSPS simulation tests 59

This managed to get my mind explode. . . . . . . . .

Opening T1 only $ n ^ {2} $, and then found that each dot need only be updated once bfs, other updates are useless.

In other words, we can only update point has not been updated?

So I first YY a list, found after deleting a number in the list, use it to update other point of time, there is no way to find it's predecessor successor, and before use can be stuck into the $ (n O ^ {2 }) $, large samples are run 2s +, and then he died.

And then to think about set, you can ensure that each point is updated only once, but I found nothing about set, always I thought begin pointing to empty, and the end point to the largest element, adjusting for a long time, later found to be opposite. . . .

Then again when dealing with a problem, still no guarantee that each point is only updated once passed this time around 2h, the mentality is still very collapse.

Then to separate parity, or not found, finally found the boundary around each point given too big.

Thus, after the opening test 2.5h, I finally think A lost T1.

He hastened the T2 violence, suddenly thought back to T1 to make a shot, found some of the data is still running very slow! (Although the game watching time has A)

Optimized a bit, stability in the 0.1s, this time left 5min, go punched 8pts T3 is gone.

T1

  The above said that.

T2.

  First, a very obviously but I do not see it concluded: order does not affect the results (because no matter how sort, any vertical and horizontal rows of two, there will be a point of intersection)

  We then all values ​​sorted in descending order, can be found, after a large number of filled out than it, the value of each region can be filled is a L-shaped (rectangular shape can be considered L)

  Only L rectangle in the middle need to ensure that legitimate, because the legitimacy elsewhere have been before to ensure that the current value can not meet those locations.

  In other words, we need to ensure that only the current rectangle where the rows and columns legitimate.

  Order rectangle $ a * b $, the upper part length is c, d is the length of the following

  Direct calculation is not easy, we consider the inclusion-exclusion

  The L split into two small rectangles, then in the case of columns to ensure that all legal, so $ F [i] indicates that at least $ i column is not lawful.

  Receiving repellent factor: $ ans = \ sum \ limits_ {i = 0} ^ {a} {(- 1) ^ {i} f_i} $

  We consider how to calculate the f [i]

  $f[i]=C_a^{i}*(s^{i}*((s+1)^{a+c-i}-s^{a+c-i}))^{b}*(s^{i}*(s+1)^{a-i})^{d}$

  With this formula violent count on the line, it should be very good understanding of

Guess you like

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