Tetrooj Box
Tetrooj Box
- 比赛主页
- 我的提交
时间限制:C/C++ 5秒,其他语言10秒
空间限制:C/C++ 262144K,其他语言524288K
64bit IO Format: %lld
题目描述
Dr. Orooji’s children have played Tetris but are not willing to help Dr. O with a related problem.
Dr. O’s children don’t realize that Dr. O is lucky to have access to 100+ great problem solvers and
great programmers today!
Dr. O knows the length of the base for a 2D box and wants to figure out the needed height for the
box. Dr. O will drop some 2D blocks (rectangles) on the base. A block will go down until it lands
on the base or is stopped by an already-dropped block (i.e., it lands on that block). After all the
blocks have been dropped, we can determine the needed height for the box – the tallest column is
the needed height (please see pictures on the next page corresponding to Sample Input/Output).
输入描述:
The first input line contains two integers:b(1 ≤b≤ 100), indicating the length of the base andr (1 ≤r≤50), indicating the number of blocks (rectangular pieces) to be dropped. Each of the next rinput lines contains three integers: a block’shorizontal lengthh(1 ≤h≤100), the block’svertical lengthv(1 ≤v≤100), andc(c≥1), the leftmost column the block is dropped into. Assume that thehandcvalues will be such that the block will not go beyond the box base, i.e., (c+h–1)≤b.
输出描述:
Print the needed height for the box (the tallest column is the height).
示例1
输入
复制
10 4 2 3 1 4 2 2 1 7 6 1 3 4
输出
复制
8
说明
示例2
输入
复制
10 3 3 4 8 8 2 1 1 1 3
输出
复制
7
说明
#include<iostream>
#include<set>
#include<cstring>using namespace std;
int main(){int d,n;cin>>d>>n;int a[110][11000];memset(a, 0, sizeof(a));int c,k,cc;int max=0;for(int i=0;i<n;i++){cin>>c>>k>>cc;int maxh=1;for(int j=cc+1;j<cc+c;j++){for(int h=0;h<110;h++){if(a[j][h]==1&&h>maxh)maxh=h;}}for(int j=cc;j<=cc+c;j++){for(int h=maxh;h<=maxh+k;h++){a[j][h]=1;}}}for(int i=0;i<110;i++){for(int j=0;j<110;j++){if(a[i][j]==1&&j>max){max=j;}}}cout<<max;
}
Tetrooj Box相关推荐
- 远程控制virtual box虚拟机系统的三种方式
远程控制virtual box虚拟机系统的三种方式[阅读时间:5分钟] 1.使用现有的远程控制软件 2.使用SSH连接 3.使用远程桌面控制虚拟机系统 对于把虚拟机安装在寝室笔记本的人来说,能够远程控 ...
- ICE BOX 配置,使用----第一篇
一 理论部分 (1) 为什么要使用icebox? icebox server代替了通常的server. icebox是为了方便集中管理多个ice服务而建立的. 它通过使用icebox服务器,把ice服 ...
- IE的box模型显示bug
原作者charlee.原始链接http://tech.idv2.com/2007/01/02/ie-box-model-bug/以及本声明. box模型即由<div>等块元素的 margi ...
- 手动部署OpenStack环境(一:Virtual Box 5.1 环境的安装及配置)
任务一.Virtual Box 5.1 环境的安装及配置 1.1.安装环境检查 1.2.创建安装目录 1.3.安装及配置 实验目的及要求 完成Virtual box平台安装,会应用相关操作: 在vir ...
- OpenStack环境搭建(一:Virtual Box 5.1 环境的安装及配置)
实验要求: 完成Virtual box平台安装,会应用相关操作: 在virtual box虚拟平台上部署Fuel Master节点: 在virtual box虚拟平台上部署计算节点Computer: ...
- Virtual Box+Centos7.0+Kaldi安装
Kaldi Kaldi是一个强大的语音识别工具库(ASR),主要由Daniel Povey开发和维护.目前支持GMM-HMM.SGMM-HMM.DNN-HMM等多种语音识别的模型的训练和预测.其中DN ...
- Windows10+Virtual box+ubuntu17.10
1.从官网下载virtual box 和 ubuntu17.10的desktop镜像 ubuntu 17.10 镜像的下载链接 virtual box的下载链接 2.打开VirtualBox,选择新建 ...
- Python使用matplotlib可视化箱图、seaborn中的boxplot函数可视化分组箱图、在箱图中添加抖动数据点(Dot + Box Plot)
Python使用matplotlib可视化箱图.seaborn中的boxplot函数可视化分组箱图.在箱图中添加抖动数据点(Dot + Box Plot) 目录
- R语言ggplot2可视化:可视化箱图、在箱图中添加抖动数据点(Dot + Box Plot)、自定义抖动数据点的大小、颜色、数据点分布在箱图中间、添加主标题、副标题、题注信息
R语言ggplot2可视化:可视化箱图.在箱图中添加抖动数据点(Dot + Box Plot).自定义抖动数据点的大小.颜色.数据点分布在箱图中间.添加主标题.副标题.题注信息 目录
最新文章
- pytorch volatile 和 requires_grad
- 【编程】二叉树的先序、中序、后序遍历
- AI理论知识整理(8)-素数与最大公因数
- Jquery复习(七)之尺寸
- TCP-Traceroute 核心代码
- [置顶] 从零开始学C++之STL(二):实现简单容器模板类Vec(vector capacity 增长问题、allocator 内存分配器)...
- 三维重建_基于RGB-D相机的三维重建总览(静态动态)
- python基于给定时间戳生成 未来/过去 前进/倒退 n个时刻的时间戳操作大全(包括秒、分钟、小时、天、星期、月、年)
- Mysql update 语句(chm文档)
- 怎样在全球的Azure上开Case
- java swing登录界面_JAVA SWing实现登陆界面
- 惠普打印机换硒鼓图解_惠普激光打印机硒鼓安装方法(图文)
- 有效需求预测的四大优势
- Clickhouse数据库web可视化工具Sqlpad
- 项目管理十大知识领域(二)--- 项目范围管理(过程、输入、工具和技术、输出)
- [Erlang]AC自动机过滤屏蔽词
- winscp登录主机拒绝_winscp连接被拒绝怎么解决
- Zxing生成自定义二维码样式
- visio移动变得很卡的解决办法
- 朋友去华为面试,轻松拿到26K的Offer,羡慕了......
热门文章
- 我的同事妹妹深夜来我家问我MyBatis源码解析,我是这样给她讲的
- 【多媒体封装格式详解】---ASF(WMV/WMA)【2】完
- 计算机软件与微电子专业,系专业跟年级_ 计算机软件跟微电子专业98级.doc
- 数据库选型十八摸 之 PostgreSQL - 致 架构师、开发者
- 网站获得高质量外链的两大绝招
- 基于ESP8266的微信门铃
- 百度崔珊珊讲给年轻人的九个故事:和百度一起成长,然后改变世界
- 助力文化荟萃,区块链或可打造“新”春晚?
- coursera课程下载_如何在永远消失之前下载Coursera的课程
- 【学习笔记】Argus--H5游戏性能测试工具