2019.12.21 [group] NOIP improve analog Group A summary

Gufen: 100 + 0 + 10 = 110

Actual Score: 0 + 10 + 100 = 110

The fraction estimated very accurate, but it looks like a little problem position on the subject. . .

 

T1:

The number of topic effect that lets you find the longest full array of n rises at most sequence comprising a number of k and a given number k.

Like pressure dp.

Of which the original arrangement legitimate and sufficient conditions are: 

1. The sequence is given in the original sequence are arranged;

2. The arrangement of the original length of the longest sequence increased to be k.

F may be provided [S] represents the number of states selected from the sequences of these programs is the number of hours the S configuration satisfying the condition.

A condition is relatively easy to satisfy, may be represented by n-bit binary numbers each number appears too. Departure transferred from the current state, the next enumeration sequence number x, there are two cases: If x is not in a given sequence, can be directly added; if x in the sequence given, is required a front sub-sequence number has appeared in the current state.

The second condition is where the bottleneck this question, we must have the ability to determine the state of the length of the longest sub-x rises after the end of the sequence enumeration next sequence number x. Obviously, if the end of each number appeared to increase the current longest sequence length are recorded is unbearable. However, if we do not rise up to record the length of each sub-sequence number at the end of the current appeared to be able to transfer, which makes us think of the classic O (nlogn) seeking sequences of length n longest rise subsequence algorithm.

In this algorithm, we need ongoing maintenance to a minimum length rise at the end of the sequence i, which is a monotonically increasing sequence, here referred to as the smallest end of the sequence. So we also can be represented by n-bit binary numbers each end of the sequence number is a minimum, so that the use of monotonically increasing nature of the smallest end of the sequence can be restored, so that after the next enumeration sequence number x in O ( n) time complexity rises up to find the length of the end of the sub-sequence x.

  Since the end of the minimum number sequence must have appeared the number, we made these two n-bit binary numbers into one binary number of n bits to three.

For a ternary number, 0 indicates no election, but chose not 1 represents the minimum end of the sequence, and 2 represents a group selected the smallest end of the sequence.

At the time of the transfer, we enumerate small to large x, x try to join, while meeting the above conditions 1 and 2 also need to meet the conditions. It is noteworthy that the original classical practice of partial-half from front to back us directly into enumeration and post-enumeration x larger location not use reduction, direct enumeration can continue in the future.

Note that when there is a new addition of a certain number of hours we moved it to a minimum the end of the sequence, while there may be kicked out at a minimum number of end of the sequence, thus making a 2 digit number originally became 1, 1 which could become a transfer to a smaller state, then we can represent the meaning of 1 and 2 swap it, so when we transfer directly to enumerate the number of digits is located (expressed in the election and the minimal sequence ) and then the kick digit number where minimal sequence becomes 2 (but not selected from the minimal sequence). So that we can successfully transferred.

The time complexity of O (3 ^ n * n), the spatial complexity of O (3 ^ n).

 

T2:

It can be converted to a network flow model.

Establishing the source and sink, a first class from the source point of a person even inf edge capacities, each student class students even a back side, the right side as a negative energy before the i-th and students. The last man the same class even negative energy of this class to everyone and meeting point. Because it requires to be selected from each class, and therefore can not cutting edge from the source to the first person, in addition, the front side of a person i represents each of the class selected from a cut. For a constraint, up to the class u v w less choice than the individual classes. That cut edge after the first class u i point edge before the first class v iw point on can not be cut, then we from this point i u inf even a class to the class iw edge to v Finally, while running a minimum cut is the answer.

 

T3:

Casual play.

The first two sequences are added.

Erasing all of the number greater than one.

carry.

Above operation is repeated until the above-described operation can not make any.

A swap. . .

 

Summary: This game did not commit a stupid mistake, but the scores can continue to improve. The second question should be thought of as a network flow model, we can do some of the topics in this area.

But the first question and no understanding of the meaning of the title, subject requirements longest sequence length is the increase in k, but I ignored this condition. Under this condition can not forget dg factorial. The use-like pressure dp.

 

发布了199 篇原创文章 · 获赞 201 · 访问量 2万+

Guess you like

Origin blog.csdn.net/zsjzliziyang/article/details/103674185
Recommended