hdu 1025 Constructing Roads In JGShining's Kingdom

最长上升子序列

题意:有2条线,每条线上有n个点,现在给你一些连接方式,一条线的点去连接另外一条线上的点。问这些线不交叉,最多能连多少条线

#include
#include
#include
#include
#define maxn 500100
using namespace std;
struct tt
{
    int x,y;
}A[maxn];
struct node
{
    int a,b;
} N[maxn];
bool cmp(struct node a,struct node b)
{
    if(a.a==b.a)return a.bA[len-1].x&&N[i].b>A[len-1].y)
            {
                A[len].x=N[i].a,A[len].y=N[i].b;
                len++;
            }
            else
            {
                int top=Find(len,N[i].a,N[i].b);
                A[top].x=N[i].a,A[top].y=N[i].b;
            }
        }
        printf("Case %d:\n",++ans);
        if(len==1)printf("My king, at most %d road can be built.\n\n",len);
        else printf("My king, at most %d roads can be built.\n\n",len);
       
    }
    return 0;
}


你可能感兴趣的:(hdu,dp)