36 analog solution to a problem

A. Character

In question to ensure $ p_i <= 1e5 $, apparently also found that when the total length is more than $ p_ {max} + c $, and more preferably will not.

Thus the size of the length of the enumeration.

Each a modulo length limit.

Obviously if the interval where the two characters adjacent intersection exists, it means the state illegal.

Thereby obtaining $ O (m * p_ {max}) $ violent.

If you have not found legitimate, you can jump directly to the modulo the process.

 

In this algorithm the random data has been very good,

But if the special configurations are able to swap cards: for example, gives the characters 0 10 000 positions, most algorithms can not be pruned.

 

Consider optimization.

We ask each character is actually the minimum and maximum values ​​in the lower die sense.

Thus a pretreatment directly around each point nearest a point of the character.

In statistical process continue to index + len, it represents a period of range currently considered the most value within the same period of the interval is obvious.

The harmonic series, this complexity is $ O (p_ {max} * logp_ {max}) $

 

When the exam this problem just started to play violent, and after a sample directly pay.

Because there is a relatively difficult card confident pruning, by displaying $ submit $ time, I guess it should be A out.

But my heart is still very uneasy, made a st table, the complexity of, and tune an hour.

Finished only to find that violence did not delete the $ freopen $, so instead of playing a positive solution is right?

 

B. Cake

Direct interval dp,

Consider what is legal status would be finished.

 

 

 

C. Game

Consider a property:

The path of the manifold is constant

Guess you like

Origin www.cnblogs.com/skyh/p/11465139.html
Recommended