摘要:
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4001亚洲区预选赛大连赛区的网络赛题目,简单的DP,首先按照长度宽度和id值进行一遍排序,这一遍排序虽然保证不了在第i个前面的都是可以被第i个放到其上面的,但是保证了在第i个后面的都是不可以的。排序之后的dp[i]表示第i个放上之后的最优值。View Code 1 #include<iostream> 2 #include<cstring> 3 #include<cstdio> 4 #include<cstdlib> 5 #define N 1005 6 阅读全文
posted @ 2012-08-28 16:13
zhenhai
阅读(155)
评论(0)
推荐(0)
摘要:
链接:http://poj.org/problem?id=2823利用单调队列的出队入队,维护区间的最值,保证队列单调递增或单调递减,要维护单调递增队列,当一个数字插入的时候,从队尾往前找到第一个比它小的值把后面的值都删掉,然后把这个值放在找到的位置的后面,单调递减队列也是类似的情况,因为是单调序列,查找过程可以用二分查找。View Code 1 #include<iostream> 2 #include<cstdio> 3 #include<cstring> 4 #define N 1000005 5 using namespace std; 6 int 阅读全文
posted @ 2012-08-28 13:00
zhenhai
阅读(186)
评论(0)
推荐(0)

浙公网安备 33010602011771号