23 analog solution to a problem

EDITORIAL:

This exam questions is relatively simple, mainly each question can be to beat.

Watching the start of the examination questions,

T3 hit over 50 points of sub-section, the results of the introduction of T3 little over an hour, to take over the limit data is no problem, the A steady.

Back half an hour to cut off most water T1, he wrote the most violent.

 

 

 

 

A. mine

Provided dp (i, 0/1/2 / 3,0 / 1) i represents the bit before, and the program of the i-th bit is filled 0/1/2 / bomb.

When the i-th bit of time to fill in 1, we need to focus on bomb left or right side of 1,

Semi-dimensional representation of the bomb so add in which side 1, when i is not 1, the last dimension meaningless.

Simple transfer.

 

 

 

B. water

At first glance: Direct consider approaching four locations, $ O (nm) $ immediate results? So simple?

The second eye: I was wrong, that ye fight?

Third Eye: half height, directly DFS, complexity $ O (n ^ 2m ^ 2log1e9) $, instantaneous explosion.

Code code code is then, take violence against violence, madness does not make sense, or 60-point card often.

 

Correct answer is a heap of bfs, or rather prim algorithm.

For each point in the rectangle, a maximum required just to live in this point enclosing polygon.

The bucket theory, entitled converted minimum value to a maximum value for the sake of the height of each point on the path of all the rectangular boundary.

The answer is obvious rectangular boundary of the rectangular boundary into the heap,

Remove the constantly updated approaching the minimum point.

 

 

 

C. gcd

Title required to maintain a data structure,

Add Remove a support is not greater than the number of 5e5,

After each operation required to answer the data structure of the number of prime numbers.

The second part of the divided tips we can use the barrel.

Think Coprime, gcd is 1, it should be related to the quality factor.

When the number two common prime factors not present, the two prime numbers.

Vigorously inclusion and exclusion.

We are not concerned about each containing a number of prime factors of how much power, only concerned with whether they contain.

Found that the special nature of the number of data within 5e5 range, up to six different prime factors.

Therefore, the operation for each $ O (2 ^ 6) $ is feasible.

Adding a number of contributions to:

Bucket all the elements, minus the presence of at least one element common prime factors, coupled with the presence of at least two elements in common prime factors, and so on.

Enumeration 0 ~ $ 2 ^ n $ -1 string 01, showing the presence or absence of each prime factor.

Because the subject of the request is relatively simple, we simply intuitive understanding has been the inclusion-exclusion formula.

This equation and Mobius inversion results are the same in nature,

But it takes advantage of the nature of gcd 1 directly overlooked the Möbius function result 0:00 meaningless.

Guess you like

Origin www.cnblogs.com/skyh/p/11362880.html