题目分析:矩形嵌套,很水的DP,先按长(宽)递增排序,再按宽(长)二级排序,类似最长上升子序列,
dp[i]=max(dp[j])+1; 1<=j<i;
原题链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=16
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
struct node{
int a,b;
}arr[1200];
int dp[1200];
int cmp(node x,node y)
{
if(x.a==y.a)
return x.b<y.b;
else
return x.a<y.a;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n,x,y......
阅读全文