hdu 4614 线段树】的更多相关文章

题意 给出一排空花瓶 有两种操作  1是 从A花瓶开始放F朵花 如果当前瓶有花就跳过前往下一个 直到花用完或者 瓶子到了最后一个为止 输出 成功放花的第一个和最后一个  如果没有输出 can not....... 2是 清空 一段区间的花 并输出清空了多少朵花 思路:用线段树维护一段区间有多少空花瓶  1操作 就是两次二分 分别求起点和终点   起点  check条件是  query(1,a,mid)>0  终点是  query(1,二分出的起点,mid)>=min(f,query(1,a,n…
Vases and Flowers 题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=4614 Problem Description Alice is so popular that she can receive many flowers everyday. She has N vases numbered from 0 to N-1. When she receive some flowers, she will try to put them…
思路:当k为1的时候,用二分法查询包含有f个空瓶的上界r,然后更新会方便很多,直接更新区间(a,r)了. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<cmath> #define lson(x) (x<<1) #define rson(x) ((x<<1)+1) #define mid ((tree[p…
Weak Pair Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 439    Accepted Submission(s): 155 Problem Description You are given a rooted tree of N nodes, labeled from 1 to N. To the ith node a…
Assign the task Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1647    Accepted Submission(s): 753 Problem Description There is a company that has N employees(numbered from 1 to N),every emplo…
Queue-jumpers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3348    Accepted Submission(s): 904 Problem Description Ponyo and Garfield are waiting outside the box-office for their favorite mo…
Sequence operation Time Limit: 10000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7502    Accepted Submission(s): 2233 Problem Description lxhgww got a sequence contains n characters which are all '0's or '1…
Transformation Time Limit: 15000/8000 MS (Java/Others)    Memory Limit: 65535/65536 K (Java/Others) Total Submission(s): 4095    Accepted Submission(s): 1008 Problem Description Yuanfang is puzzled with the question below:  There are n integers, a1,…
威威猫系列故事——晒被子 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total Submission(s): 1592    Accepted Submission(s): 444 Problem Description 因为马拉松初赛中吃鸡腿的题目让不少人抱憾而归,威威猫一直觉得愧对大家,这几天他悄悄搬到直角坐标系里去住了. 生活还要继续,太阳也照常升起,今天,威威猫在…
Memory Control Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5913    Accepted Submission(s): 1380 Problem Description Memory units are numbered from 1 up to N. A sequence of memory units is c…