【HDU2795】Billboard(线段树)】的更多相关文章

Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 10594    Accepted Submission(s): 4686 Problem Description At the entrance to the university, there is a huge rectangular billboard of s…
Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 8266    Accepted Submission(s): 3676 Problem Description At the entrance to the university, there is a huge rectangular billboard of s…
传送门 结点中的l和r表示层数,maxx表示这层最多还剩下多少宽度.根据公告的宽度取找到可以放的那一层 找到后返回层数,并修改maxx #include<bits/stdc++.h> using namespace std; +; int h,w; int ans; struct Node { int l,r,maxx;//l和r是层数,maxx是每层还有多少空位 } node[maxn<<]; void PushUp(int k) { node[k].maxx=max(node[…
HUD.2795 Billboard ( 线段树 区间最值 单点更新 单点查询 建树技巧) 题意分析 题目大意:一个h*w的公告牌,要在其上贴公告. 输入的是1*wi的w值,这些是公告的尺寸. 贴公告要满足的条件: 1. 尽量往上,同一高度尽量靠左. 2. 求第n个广告所在的行数. 3. 没有合适的位置贴了则输出-1. 建树技巧 首先看了一下数据范围h和w都在1e9,按照高度建树不太现实的.但是发现询问只有2e5,.仔细想一下如果h < 2e5, 我们用h建树,否则用n建树.原因是,每个高度只放…
Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 11861    Accepted Submission(s): 5223 Problem Description At the entrance to the university, there is a huge rectangular billboard of s…
Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 16755    Accepted Submission(s): 7089 Problem Description At the entrance to the university, there is a huge rectangular billboard of…
Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 21203    Accepted Submission(s): 8750 Problem Description At the entrance to the university, there is a huge rectangular billboard of…
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…
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 the place where all possible announcements are posted: nearest programming competitions, changes in th…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2795 题目大意:有一块h*w的矩形广告板,要往上面贴广告;   然后给n个1*wi的广告,要求把广告贴上去: 而且要求广告要尽量往上贴并且尽量靠左;  求每个广告的所在的位置,不能贴则为-1. 用线段树模拟,要是左子树的最大值比当前广告大,就查询更新左子树,否则就右子树. #include <iostream> #include <cstdio> #include <cstrin…