poj3667 Hotel区间合并入门题,照着代码打的,题意:1 a:询问是不是有连续长度为a的空房间,有的话住进最左边 2 a b:将[a,a+b-1]的房间清空思路:记录区间中最长的空房间,开三个数组,msum[rt]表示节点rt内连续的1的个数的最大值,lsum[rt]表示从节点rt左端点.....
分类:
其他好文 时间:
2014-08-17 00:57:01
阅读次数:
207
http://acm.hdu.edu.cn/showproblem.php?pid=1255
一道挺简单的题,让我折腾了许久。主要卡在了更新节点后维护父亲节点上。后来思路明确了就很容易了。
节点信息:
l,r:区间端点
cnt:区间被覆盖的次数,cnt = 0说明没有被完全覆盖。
len1:区间被覆盖的长度
len2:区间至少被两条线段覆盖的长度。
只要找到父亲节点与...
分类:
其他好文 时间:
2014-08-16 19:49:51
阅读次数:
218
题目链接:点击打开链接
题意就是求最大面积
枚举每个柱子作为起点
然后二分两边长度。 求个区间最值。
#include
#include
#include
using namespace std;
#define ll long long
#define N 100100
inline bool rd(int &n){
int x = 0, tmp = 1;
...
分类:
其他好文 时间:
2014-08-16 18:34:41
阅读次数:
228
题目大意:
在一串数字中取出除了两端的两个数字,求出最小的代价,代价就是每取出一个数,都要加上它与它相邻的两个数的积。
思路分析:
状态方程 :dp [i] [j] 是区间 [i , j] 已经全部取完,只剩下 i j所剩的最小代价。
状态转移 :dp [i][j] = min (dp [i][j], dp[i][k] + dp[k] [j] + a[i]*a[k]*a[j]) ....
分类:
其他好文 时间:
2014-08-16 17:11:00
阅读次数:
230
1 //Accepted 200 KB 63 ms 2 //区间dp 3 //dp[i][j] 从i位到j位能得到的最大匹配数 4 //dp[i][j]=max(dp[i+1][j-1] (s[i-1]==s[j-1]),dp[i][k]+dp[k+1][j])i 6 #include...
分类:
其他好文 时间:
2014-08-16 17:07:00
阅读次数:
189
1 //Accepted 244 KB 0 ms 2 //区间dp 3 //石子合并模型 4 #include 5 #include 6 #include 7 using namespace std; 8 const int imax_n = 105; 9 const int P...
分类:
其他好文 时间:
2014-08-16 17:03:20
阅读次数:
358
http://acm.hdu.edu.cn/showproblem.php?pid=4027x可能比y大。 区间的每一个数在经过几次开方之后会变成1之后,在这个区间全部变成1之后,这个区间不用向下更新。这里可以判断一下。。 1 #include 2 #include 3 #include ...
分类:
其他好文 时间:
2014-08-16 16:27:10
阅读次数:
179
Let us define a regular brackets sequence in the following way:
1. Empty sequence is a regular sequence.
2. If S is a regular sequence, then (S) and [S] are both regular sequences.
3. If A an...
分类:
其他好文 时间:
2014-08-16 15:10:30
阅读次数:
262
Description
The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city counci...
分类:
其他好文 时间:
2014-08-16 13:53:40
阅读次数:
679
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=610先用线段树维护区间颜色的覆盖,然后在把区间的颜色映射到数组,再从数组统计颜色。 1 #include 2 #include 3 #include 4 #defin...
分类:
其他好文 时间:
2014-08-15 22:27:51
阅读次数:
249