(Reprinted) study of the Dilworth theorem of the ordering Set

Source: Internet
Author: User

Missile interception is a classic problem: finding the longest non-ascending subsequence of a sequence, and finding that it can be divided into at least several non-ascending subsequences. The first question is classic dynamic planning. The second question is the direct method of least path coverage, but the complexity of bipartite graph matching is high. We can convert it into the longest ascending subsequence, the maximum value is equal to the minimum number of subsequences that do not rise. This involves the Dilworth theorem of the ordinal set in the composite mathematics. (The greedy method in the second question is actually the process of proving this theorem)

Both the first and second questions can be solved using the O (nlogn) algorithm:

 

# Include <cstdio>

# Include <cstring>

# Include <algorithm>

Using namespace STD;

Int A [100], F [100], G [100];

Int main (){

Freopen ("LMIS. In", "r", stdin );

Freopen ("LMIS. Out", "W", stdout );

Int N, I;

Scanf ("% d", & N );

Memset (G, 0x7f, sizeof (g ));

Memset (F, 0, sizeof (f ));

For (I = 0; I <n; I ++)

Scanf ("% d", & A [I ++]);

For (I = 0; I <n; I ++ ){

Int K = lower_bound (G + 1, G + n, a [I])-G;

F [I] = k + 1;

G [k + 1] = A [I];

}

Printf ("% d \ n", * max_element (F, F + n ));

Return 0;

}

 

Appendix: memset (ARR, 0x7f, sizeof (ARR); // set int to 2139062143

Memset (ARR, 0x80, sizeof (ARR); // set int to-2139062144
Memset (ARR, 0x7f, sizeof (ARR); // set double to 1.38242e + 306
Memset (ARR, 0xfe, sizeof (ARR); // set double to-5.31401e + 303

First, we will introduce the partial order relationship:

The partial order is the ≤ (this is only an abstract symbol, not "less than or equal to") of the binary relationship on the X set. It satisfies the self-inversion, anti-symmetry, and transmission. That is, for any element A, B, and C in X, there are:

Self-defense: A ≤;

Anti-symmetry: If a ≤ B and B ≤ A, There Is A = B;

Transmission: If a is less than or equal to B and B is less than or equal to C, A is less than or equal to C.



A set with a partial order relationship is called a partial sequence set.

(X, ≤) is a partial sequence set. For two elements A and B in a set, if a ≤ B or B ≤ A, A and B are comparable, otherwise, A and B are incomparable.



In X, for element a, if any element B is obtained from B ≤ a, B = A is called a as the smallest element.

A anti-chain a is a subset of X, and neither of its two elements can be compared.

A chain C is a subset of X, and its two elements are comparable.



The following are two important theorems:

Theorem 1 (X, ≤) is a finite ordinal set, and r is the maximum chain size. Then, X can be divided into R anti-chains but cannot be less.

Its Dual theorem is called the Dilworth theorem:

Theorem 2 (x, ≤) is a finite ordinal set, and m is the maximum size of the anti-chain. Then, X can be divided into M chains but no less chains.

Although the two theorem have similar content, the first theorem must be simpler. Here, only Theorem 1 is proved.

Proof: Set P to the minimum number of anti-links

(1) first, it is proved that X cannot be divided into less than R anti-chains. Since R is the size of the maximum chain C, any two elements in C are comparable, so any two elements in C cannot belong to the same anti-chain. So P> = R.

(2) If X1 = x, A1 is the set of minimum elements in X1. Delete A1 from X1 to obtain X2. Note that any Element A2 in X2 must have Element A1 in X1, so that A1 <= a2. So that A2 is the set of minimum elements in X2, and delete A2 from X2 to get X3 ...... In the end, an XK is not null, and X (k + 1) is null. So A1, A2 ,..., AK is the anti-Chain Division of X, and there is a chain A1 <= a2 <=... <= Ak, where Ai is in AI. Because r is the size of the longest chain, r> = K. Since X is divided into k anti-chains, r> = k> = P. Therefore, r = P, Theorem 1 is proved.



Let's look back at the second question about missile interception. We define a partial order relationship ≤: A ≤ B, indicating that a appears no later than B and the value of A is not less than B. The longest anti-chain of this ordinal set is the longest ascending subsequence, and its non-ascending subsequence is the chain of the ordinal set. According to the Dilworth theorem, the minimum number of subsequences without ascending is the length of the longest ascending subsequence.



P.s. The greedy method here is that every time we select all the numbers not greater than or equal to it before it as a group. In fact, each time we choose the smallest element of the partial sequence set, the final answer we get is the K above. R = k = P can be obtained from r <= P and R> = k> = P, so greedy and correct.

References: Introductory combinatorics fourth edition, Richard A. Brualdi

Reference: http://www.608088.com/show-2730-1.html

(Reprinted) study of the Dilworth theorem of the ordering Set

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.