子集序列的最大连续值问题的算法,如何利用C语言的方式编程来实现

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
3
1 3
3 1
2 2
4
1 2
2 1
4 3
3 4

Sample Output
2
4

问题描述
我知道你们已经解决了许多关于增加序列的问题,这一次,已经做了一点改变。
假设有一个序列S = {s1,s2,s3,...,sn},si =(xi,yi)。你应该找到两个增加的子序列L1和L2,它们没有共同的元素,意味着L1∩ L2 =φ,并且它们的长度之和尽可能地最大。
这里我们假设si> sj是(xi> xj && yi> yj)或(xi> = xj && yi> yj)或(xi> xj && yi> = yj)。 我将确保所有元素的坐标是不同的,即si!= sj(i!= j)。
输入
输入包含多个测试用例。 每个案例都以包含正整数n的行开始,该正整数n是序列S的长度,接下来的n行每行包含一对整数(xi,yi),i = 1,... n.1 <= n <=5000,1<= XI,易<=2 ^ 31。
输出
对于每个测试用例,输出一行,其中包含您可以找到的两个递增子序列L1和L2的最大总和。
Sample Input
3
1 3
3 1
2 2
4
1 2
2 1
4 3
3 4
Sample Output
2
4

为了回答问题,先把您的问题机翻了一遍,不是很懂您想问什么。但关于子集序列的最大连续值问题的算法,我还是有一些想法的。
给您举个栗子:
如给定序列{ -2, 11, -4, 13, -5, -2 },其最大连续子序列为{11,-4,13},最大连续子序列和即为20。
那么我们可以直接入手代码,求出所有可能连续子列的和即可:

int MaxSubSequm1(int A[], int N)
{
int oneSum, maxSum = 0;
int i, j, k;
for (i = 0; i < N; i++) {

for (j = i; j < N; j++){
oneSum = 0;

for (k = i; k <= j; k++)

oneSum += A[k];

if (oneSum>maxSum)

maxSum = oneSum;

    }

}
return maxSum;   

}

我只能做到一种方法,这边有一位博主的详尽解答,希望对您有所帮助。
https://blog.csdn.net/zxc123e/article/details/79679488