P2894 [USACO08FEB]酒店Hotel 题目描述 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 fam…
P2894 [USACO08FEB]酒店Hotel https://www.luogu.org/problem/show?pid=2894 题目描述 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…
题目传送门 酒店 题目描述 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 Str…
题目描述 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 Street as th…
https://www.luogu.org/problem/P2894 #include<cstdio> #include<iostream> using namespace std; struct ben { int lmax,rmax,len,sum,lz; }tr[400005]; void bt(int x,int l,int r)//建树 { tr[x].lz=0;//标记清空 tr[x].sum=tr[x].len=tr[x].lmax=tr[x].rmax=r-l+1…
问题描述 奶牛们最近的旅游计划,是到苏必利尔湖畔,享受那里的湖光山色,以及明媚的阳光.作为整个旅游的策划者和负责人,贝茜选择在湖边的一家著名的旅馆住宿.这个巨大的旅馆一共有N (1 <= N <= 50,000)间客房,它们在同一层楼中顺次一字排开,在任何一个房间里,只需要拉开窗帘,就能见到波光粼粼的湖面. 贝茜一行,以及其他慕名而来的旅游者,都是一批批地来到旅馆的服务台,希望能订到D_i (1 <= D_i <= N)间连续的房间.服务台的接待工作也很简单:如果存在r满足编号为r…
P2894 [USACO08FEB]酒店Hotel 题目描述 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 fam…
P1402 酒店之王 题目描述 XX酒店的老板想成为酒店之王,本着这种希望,第一步要将酒店变得人性化.由于很多来住店的旅客有自己喜好的房间色调.阳光等,也有自己所爱的菜,但是该酒店只有p间房间,一天只有固定的q道不同的菜. 有一天来了n个客人,每个客人说出了自己喜欢哪些房间,喜欢哪道菜.但是很不幸,可能做不到让所有顾客满意(满意的条件是住进喜欢的房间,吃到喜欢的菜). 这里要怎么分配,能使最多顾客满意呢? 输入输出格式 输入格式: 第一行给出三个正整数表示n,p,q(<=100). 之后n行,每…
Code: #include<cstdio> #include<algorithm> #include<cstring> using namespace std; const int N = 200000+5; int n,m,k; struct Segment_Tree{ int lazy,left,right,maxv; }Seg[N<<2]; inline void push_down(int o,int l,int r) { if(Seg[o].la…
题目描述 用线段树维护三个值:区间最长空位长度,从左端点可以延伸的最长空位长度,从右端点可以延伸的最长空位长度. #include<complex> #include<cstdio> using namespace std; ; int n,m; int len[N],Max[N],maxl[N],maxr[N],lazy[N]; int qread() { ; char ch=getchar(); ')ch=getchar(); +ch-';ch=getchar();} retu…