hdu1677 Nested Dolls
来源:互联网 发布:mac桌面工具栏不见了 编辑:程序博客网 时间:2024/05/29 19:26
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1677
#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAXN 20002struct node {int w,h;}dolls[MAXN];int dp[MAXN];int cmp(const void *x,const void *y){if((*(struct node *)y).w==(*(struct node *)x).w)return (*(struct node *)x).h-(*(struct node *)y).h;elsereturn (*(struct node *)y).w-(*(struct node *)x).w;}int main(){int test,n,i,j,k,left,right,mid,lenmax;scanf("%d",&test);while(test--){memset(dp,0,sizeof(dp));scanf("%d",&n);for(i=0;i<n;++i)scanf("%d %d",&dolls[i].w,&dolls[i].h);qsort(dolls,n,sizeof(dolls[0]),cmp);lenmax=0;for(i=0;i<n;++i){left=0;right=lenmax;while(left<right){mid=(left+right)/2;if(dp[mid]<=dolls[i].h)left=mid+1;elseright=mid;}dp[left]=dolls[i].h;if(left==lenmax)lenmax++;}printf("%d\n",lenmax);}return 0;}
- HDU1677 Nested Dolls
- HDU1677:Nested Dolls
- hdu1677 Nested Dolls
- Nested Dolls(hdu1677(LIS))
- hdu1677 Nested Dolls(贪心)
- hdu1677 Nested Dolls Dilworth定理
- hdu1677--Nested Dolls(贪心+LIS)
- hdu1677—Nested Dolls(贪心)
- hdu1257 最少拦截系统 hdu1677 Nested Dolls(最长上升子序列)
- Nested Dolls
- Nested Dolls
- Nested Dolls
- hd 1677 Nested Dolls
- zoj 2882 Nested Dolls
- poj3636 Nested Dolls
- 【贪心】poj3636 nested dolls
- POJ 3636 Nested Dolls
- hdu 1677 Nested Dolls
- UML各种视图的简介
- 统计单词出现最多的个数
- 老码农教你学英语
- 关于信号量的初次尝试
- image/pjpeg和image/jpeg问题
- hdu1677 Nested Dolls
- OpenQuant破解工具 | SmartQuant系列产品破解
- Android PDF开发资料
- 数据结构题目
- Inside GDALAllRegister之一: 五大部分
- ACE网络开发包
- Storm源码阅读(一):使用
- 读书方法论:经验的哲学观
- Struts2中的ModelDriven机制及其运用