1 #include2 #include 3 #define inf 1<<30 4 using namespace std; 5 6 typedef struct 7 { 8 int l,w; 9 } cus;10 cus a[5005],d[5005];11 int top;12 13 int cmp(cus x,cus y)14 {15 if(x.l == y.l)16 return x.w < y.w;17 return x.l < y.l;18 }19 20 void solven(int x,int y)21 {22 int i;23 for(i=0; i<=top; ++i)24 if(d[i].l <= x && d[i].w <= y)25 {26 d[i].l = x;27 d[i].w = y;28 break;29 }30 if(i == top + 1)31 {32 d[++top].l = x;33 d[top].w = y;34 }35 }36 37 int main()38 {39 int t,n,i;40 scanf("%d",&t);41 while(t--)42 {43 scanf("%d",&n);44 for(i=0; i