HDOJ 2795 Billboard
线段树。。。。。
Billboard
Time Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 7316 Accepted Submission(s): 3278
On September 1, the billboard was empty. One by one, the announcements started being put on the billboard.
Each announcement is a stripe of paper of unit height. More specifically, the i-th announcement is a rectangle of size 1 * wi.
When someone puts a new announcement on the billboard, she would always choose the topmost possible position for the announcement. Among all possible topmost positions she would always choose the leftmost one.
If there is no valid location for a new announcement, it is not put on the billboard (that's why some programming contests have no participants from this university).
Given the sizes of the billboard and the announcements, your task is to find the numbers of rows in which the announcements are placed.
The first line of the input file contains three integer numbers, h, w, and n (1 <= h,w <= 10^9; 1 <= n <= 200,000) - the dimensions of the billboard and the number of announcements.
Each of the next n lines contains an integer number wi (1 <= wi <= 10^9) - the width of i-th announcement.
2
4
3
3
3
2
1
3
-1
转载于:https://www.cnblogs.com/CKboss/p/3350935.html
HDOJ 2795 Billboard相关推荐
- HDU 2795 Billboard (线段树+贪心)
HDU 2795 Billboard (线段树+贪心) 手动博客搬家:本文发表于20170822 21:30:17, 原地址https://blog.csdn.net/suncongbo/articl ...
- HDU - 2795 Billboard(线段树)
题目链接:点击查看 题目大意:给定一个高度为h,宽度为w的广告牌,接下来以此给出n个高度为1,宽度为w的广告,我们需要将广告优先贴在最上边.最左边,问给出的每一个广告应该贴在哪一行,若没有位置贴了则输 ...
- 【HDU】2795 Billboard
1 #include<cstdio> 2 #define MAXN 200010 3 #define MIN(a,b) ((a)>(b)?(b):(a)) 4 #define MAX ...
- html标签可以嵌套吗,HTML标签的嵌套
随着时间的推移,我们学习html的基础知识有了大概的了解.而我发现,平时在写html文档的时候,发现不太清楚标签之间的嵌套规则,经常是想到什么标签就用那些,然而发现有时的标签嵌套却是错误的.通过网上找 ...
- HDOJ2795 Billboard【线段树】
Problem : 2795 ( Billboard ) Judge Status : Accepted RunId : 5864258 Language : C Author : ...
- 线段树开新坑:kuangbin带你飞
写在最前面的废话 这里I以前的题是暑假刚刚开始的时候在家写的,然后多校一波就荒废了 9月开头回家一波,重新填坑,= =,kuangbin带你飞的pdf,这才一半题,后面还有一波,蓝瘦,慢慢写吧,不写题 ...
- 线段树详解 (原理,实现与应用)
线段树详解 By 岩之痕 目录: 一:综述 二:原理 三:递归实现 四:非递归原理 五:非递归实现 六:线段树解题模型 七:扫描线 八:可持久化 (主席树) 九:练习题 一:综述 假设有编号从1到n的 ...
- 【转载】线段树题目2
1.hdu1166 敌兵布阵 更新节点,区间求和. 2.hdu1754 I Hate It 更新节点,区间最值. . 3.hdu1698 Just a Hook 成段更新,总区间求和. . 4.hdu ...
- 浅谈线段树(Segment Tree)
线段树的概念与性质 线段树首先是一棵树,而且是二叉树.树上的每个节点对应于一个区间[a,b],a,b通常为整数.同一层的节点所代表的区间,互相不重叠.并且同一层的区间加起来是连续的区间,叶子节点的区间 ...
最新文章
- 关于创建Custom Container View Controller
- 《Java从入门到放弃》框架入门篇:hibernate基本配置
- linux deepin/ubuntu安装flameshot火焰截图
- springboot 获取客户端ip_JAVA如何获取客户端IP地址和MAC地址
- EFI BIOS下的磁盘管理工具Diskpart,Efifmt与Efichk(转)
- 盛大游戏杯第十五届上海大学程序设计联赛暨上海金马五校赛
- Vuex和普通全局对象
- 安装Selenium+Firefox+Firepath+Firebug
- 英文横版游戏《玛丽师傅》源码H5+安卓+IOS三端源码
- adc0809工作过程C语言,ADC0809引脚图、时序图、工作流程图详解
- Kafka【问题 02】KafkaTemplate 报错 Bootstrap broker localhost:9092 (id: -1 rack: null) disconnected 问题解决
- 如何处理phpmyadmin中访问被拒绝
- 复旦大学计算机学院金玲飞,金玲飞 - 复旦大学 - 计算机科学技术学院
- 电路邱关源学习笔记——1.7基尔霍夫定律
- 迷思:Python学到什么程度可以面试工作?
- 存储文件照片哪个服务器好,照片记录的美好时光,用NAS存储吧
- 基于Springboot+vue的服装销售购物商城网站 毕业设计源码
- 数字后端基本概念介绍——Track
- 【Java】推箱子小游戏(带背景音乐)完整代码
- 2015应届生面试经历;