POJ-2726-Holiday Hotel】的更多相关文章

Hotel Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 13805   Accepted: 5996 Description The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessie…
两个题目都是用同一个模板,询问最长的连续未覆盖的区间 . lazy代表是否有人,msum代表区间内最大的连续长度,lsum是从左结点往右的连续长度,rsum是从右结点往左的连续长度. 区间合并很恶心啊,各种左左右右左右左右........ #include <cstdio> #include <iostream> #include <cstring> #include <cmath> # define MAX 211111 # define ll(x) x…
#include <iostream> #include <algorithm> #define MAXN 10005 using namespace std; struct node { int a; int b; }; //node _node[MAXN]; bool op(node _a,node _b); node _n_1[MAXN]; node _n_2[MAXN]; int main() { // freopen("acm.acm","r…
Holiday Hotel   Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 8302   Accepted: 3249 Description Mr. and Mrs. Smith are going to the seaside for their holiday. Before they start off, they need to choose a hotel. They got a list of hotel…
1.TreeMap和TreeSet类:A - Language of FatMouse ZOJ1109B - For Fans of Statistics URAL 1613 C - Hardwood Species POJ 2418D - StationE - Web Navigation ZOJ 1061F - Argus ZOJ 2212G - Plug-in2.SegmentTreeA-敌兵布阵 hdu 1166B - I Hate It HDU 1754C - A Simple Pro…
题目传送门 /* 题意:输入 1 a:询问是不是有连续长度为a的空房间,有的话住进最左边 输入 2 a b:将[a,a+b-1]的房间清空 线段树(区间合并):lsum[]统计从左端点起最长连续空房间数,rsum[]类似,sum[]统计区间最长连续的空房间数, 它有三种情况:1.纯粹是左端点起的房间数:2.纯粹是右端点的房间数:3.当从左(右)房间起都连续时,加上另一个子节点 从左(右)房间起的数,sum[]再求最大值更新维护.理解没错,表达能力不足 详细解释:http://www.cnblog…
http://poj.org/problem?id=3667 Hotel Time Limit: 3000MS   Memory Limit: 65536K Total Submissions: 9484   Accepted: 4066 Description The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny s…
Description The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessie, ever the competent travel agent, has named the Bullmoose Hotel on famed Cumberland Stree…
POJ 3667 Hotel 题目链接 题意:有n个房间,如今有两个操作 1.找到连续长度a的空房间.入住,要尽量靠左边,假设有输出最左边的房间标号,假设没有输出0 2.清空[a, a + b - 1]的房间 思路:线段树的区间合并.记录下左边连续最长和右边连续最长空房间.和每一段的最大值.这样pushup的时候就是进行区间合并,注意查询的时候因为是要尽量左,所以先查左孩子,在查横跨左右的,在查右孩子 代码: #include <cstdio> #include <cstring>…
除了上次的新学的有 区间更新 延迟更新  区间合并 先说下区间更新以及延迟更新吧 既然是对区间的维护 在求解一些问题的时候 有的时候没有必要对所有的自区间都进行遍历 这个时候 延迟标记就派上用场了 (只有在需要的时候才对子区间更新) struct node(){ int l,r,len; int flag=0;}stu[maxn];void pushdown(int i){ if(stu[i].flag) { stu[i*2].flag=stu[i*2+1].flag=stu[i].flag;…