hdu 2795 公告板 (单点最值)】的更多相关文章

题意:有个公告板,大小为h*w,要贴n张公告,每个公告的长度是x,高度固定为1,公告放的要尽可能靠上并尽可能靠左,每给出一张公告,要求这个公告在满足要求的情况下放在了第几层. Sample Input3 5 524333 Sample Output1213-1 # include <iostream> # include <cstdio> # include <cstring> # include <algorithm> # include <cmat…
Billboard Time Limit:8000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 2795 Appoint description:  System Crawler  (2015-04-10) Description At the entrance to the university, there is a huge rectangular billb…
lines Time Limit: 5000/2500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1575    Accepted Submission(s): 656 Problem Description John has several lines. The lines are covered on the X axis. Let A is a point which…
Billboard (HDU 2795) Hdu 2795 注意到每个广告的长度是1,因此可以将每这一张广告牌当成一个数列表示,每个初始值为w.使用线段树维护这个数列,每次查询为找到这个数列第一个大于等于x的位置,每次修改操作为将找到的位置值-x 线段树功能:区间查询+单点更新 #include <cstdio> #include <utility> #include <queue> #include <cstring> #define scan(x) sc…
Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 19225    Accepted Submission(s): 8042 Problem Description At the entrance to the university, there is a huge rectangular billboard of…
HDU 2795 Billboard(宣传栏贴公告,线段树应用) ACM 题目地址:HDU 2795 Billboard 题意:  要在h*w宣传栏上贴公告,每条公告的高度都是为1的,并且每条公告都要尽量贴最上面最靠左边的,给你一系列的公告的长度,问它们能不能贴上. 分析:  不是非常好想,只是想到了就非常好写了.  仅仅要把宣传栏倒过来就好办了,这时候就是变成有h条位置能够填公告,填放公告时就能够尽量找最左边的合适的位置来放了.  能够用线段树实现,查找的复杂度是O(logn),须要注意的坑点…
题意 : 有一块 h * w 的公告板,现在往上面贴 n 张长恒为 1 宽为 wi 的公告,每次贴的地方都是尽量靠左靠上,问你每一张公告将被贴在1~h的哪一行?按照输入顺序给出. 分析 : 这道题说明了每一次贴都尽量选择靠上靠左的位置,那既然这样,我们以1~h建立线段树,给每一个叶子节点赋值初值 w 表示当前行最大能够容纳宽度为 w 的公告纸,那么对于某一输入 wi 只要在线段树的尽量靠左的区间找出能够容纳这张公告的位置(即叶子节点)然后减去 wi 即可,需要对query()函数进行一点改造,将…
Billboard Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2795 Description At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2795 Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13050    Accepted Submission(s): 5651 Problem Description At the entrance to the un…
Color the ball Time Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 14711    Accepted Submission(s): 7354 Problem Description N个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气…