题意:有两种操作,第一种从A开始插花,如果有花就跳到下一个,然后输出最后一个花瓶的编号,如果花瓶不够把多余的花丢掉.操作2把区间清空 分析:很明显的线段树操作,就是插花的时候麻烦一下,需要先找出来他剩余的花瓶数,要不没办法更新. ******************************************************************* #include<algorithm> #include<stdio.h> ; ;}     ;} }a[MAXN<…
题意 给出一排空花瓶 有两种操作  1是 从A花瓶开始放F朵花 如果当前瓶有花就跳过前往下一个 直到花用完或者 瓶子到了最后一个为止 输出 成功放花的第一个和最后一个  如果没有输出 can not....... 2是 清空 一段区间的花 并输出清空了多少朵花 思路:用线段树维护一段区间有多少空花瓶  1操作 就是两次二分 分别求起点和终点   起点  check条件是  query(1,a,mid)>0  终点是  query(1,二分出的起点,mid)>=min(f,query(1,a,n…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4614 线段树保存区间是否被覆盖以及区间的和即可,在询问的时候在线段树上二分查找就可以了...代码写得比较挫>< //STATUS:C++_AC_359MS_1728KB #include <functional> #include <algorithm> #include <iostream> //#include <ext/rope> #inclu…
题目0到n-1的花瓶,操作1在下标a开始插b朵花,输出始末下标.操作2清空[a,b]的花瓶,求清除的花的数量.线段树懒惰标记来更新区间.操作1,先查询0到a-1有num个空瓶子,然后用线段树的性质,或者二分找出第num+1个空瓶子的下标,和第num+b个空瓶子的下标.再区间更新为满.操作2,也相当于区间更新为空. #include<cstdio> #include<cstring> #include<algorithm> #define N 50001 using na…
Vases and Flowers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 347    Accepted Submission(s): 108 Problem Description Alice is so popular that she can receive many flowers everyday. She has…
Vases and Flowers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 3220    Accepted Submission(s): 1273 Problem Description Alice is so popular that she can receive many flowers everyday. She ha…
Vases and Flowers Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 38    Accepted Submission(s): 10 Problem Description Alice is so popular that she can receive many flowers everyday. She has N v…
http://acm.hdu.edu.cn/showproblem.php?pid=4614 Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Problem Description Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to…
Transformation Time Limit: 15000/8000 MS (Java/Others)    Memory Limit: 65535/65536 K (Java/Others)Total Submission(s): 3830    Accepted Submission(s): 940 Problem Description Yuanfang is puzzled with the question below: There are n integers, a1, a2,…
题目大意 维护一个序列,支持两种操作 操作一:将第x个元素的值修改为y 操作二:询问区间[x,y]内的元素的最大值 解题分析 splay的区间操作,事先加入两个编号最小和最大的点防止操作越界. 具体的区间操作类似于线段树. 参考程序 #include <bits/stdc++.h> using namespace std; const int INF=2000000000; const int N=200008; int a[N]; class splay_tree { public: str…