|
||||||||||
This time, two, not oneTime Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 213 Accepted Submission(s): 0 Problem Description I konw you guys have solve so many problems about increasing sequence, this time, a little change has been made. Assume that there is a sequence S = {s1, s2, s3, ..., sn}, si = (xi, yi).You should find two increasing subsequence L1 and L2, and they have no common elements, means L1¡ÉL2 = ¦Õ, and the sum of their lenth is as max as possible. Here we assume si > sj is that (xi > xj && yi > yj) or (xi >= xj && yi > yj) or (xi > xj && yi >= yj). I will ensure that all elements' coordinates are distinct, i.e., si != sj (i!=j). Input The input consists of multiple test cases. Each case begins with a line containing a positive integer n that is the length of the sequence S, the next n lines each contains a pair integers (xi, yi), i = 1,...n.1 <= n <= 5000,1<=xi,yi<=2^31. Output For each test case, output one line containing the the maximum sum of the two increasing subsequence L1 and L2 you can find. Sample Input
Sample Output
Author 8600 | ||||||||||
|