hdu2795 Billboard 线段树单点更新区间最值

告别手机小屏幕:用VSCode插件Auto.js-VSCodeExt在电脑上写手机自动化脚本(附画圆实例) 本文详细介绍如何利用VSCode插件Auto.js-VSCodeExt在PC端开发手机自动化脚本,告别手机小屏幕的限制。通过搭建专业开发环境、实战画圆脚本案例,展示PC端开发在编辑效率、调试工具和项目管理上的显著优势,帮助开发者提升3-5倍工作效率。 阅读详情

Billboard

Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 17336    Accepted Submission(s): 7318


Problem 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 the dining room menu, and other important information.

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.
 

Input
There are multiple cases (no more than 40 cases).

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.
 

Output
For each announcement (in the order they are given in the input file) output one number - the number of the row in which this announcement is placed. Rows are numbered from 1 to h, starting with the top row. If an announcement can't be put on the billboard, output "-1" for this announcement.
 

Sample Input
3 5 5 2 4 3 3 3
 

Sample Output
1 2 1 3 -1


对于线段树的规模,N取min(h, n),即如果h大, n小的话,取n,原因是h中有一部分是用不到的

如果n大,h小的话,取h,原因是,n放不下,而板子只有那么大


每个sum[rt]存区间[l, r]中的可能的单行最大容量,l == r时l or r即为板子的这一行的编号,只要在递归的时候左子树优先,就可以保证板子上面有位置先放上面的,然后再放下面

遇到能放的位置,从下到上更新区间区间内单行最大容量


#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define lson l, m, rt << 1
#define rson m + 1, r, rt << 1 | 1

using namespace std;

const int maxn = 222222;
int sum[maxn << 2], ans[maxn], len;
int h, w, n;

void PushUP(int rt) {
	sum[rt] = max(sum[rt << 1], sum[rt << 1 | 1]);
}

void build(int l, int r, int rt) {
	if (l == r) {
		//初始最大长度都是w
		sum[rt] = w;
		return;
	}
	int m = (l + r) >> 1;
	build(lson);
	build(rson);
	PushUP(rt);
}

void update(int p, int l, int r, int rt) {
	if (l == r) {
		if (sum[rt] >= p) {
			sum[rt] -= p;
			ans[len++] = l; //记录当前放得行编号
		}
		return;
	}
	int m = (l + r) >> 1;

	//注意优先更新左子树,因为要尽可能往上放
	if (sum[rt << 1] >= p) {
		update(p, lson);
	}
	else if (sum[rt << 1 | 1] >= p) {
		update(p, rson);
	}
	PushUP(rt);
}

int main()
{
	while (~scanf("%d%d%d", &h, &w, &n)) {
		memset(ans, -1, sizeof(ans));
		int N = min(h, n);
		build(1, N, 1);
		len = 0;
		for (int i = 0; i < n; i++) {
			int tem;
			scanf("%d", &tem);
			//sum[1]存的是所有的行中可能的最大的容量,范围最广
			//tem <= sum[1]说明所有的行都放不下了,没必要更新
			if (tem <= sum[1]) {
				update(tem, 1, N, 1);
			}
			else {
				len++;  //注意跳过
			}
		}
		for (int i = 0; i < n; i++) {
			printf("%d\n", ans[i]);
		}
	}
	return 0;
}



Java派单系统实战:双层权重调度与状态机一致性设计 任务派单系统是物流、本地生活等实时服务场景的核心基础设施,其本质是基于地理围栏与动态权重的实时任务分配问题。原理上需融合距离计算、负载均衡、履约率评估等多维因子,并通过分布式锁、状态机、本地缓存等机制保障数据强一致与高可用。技术价值体现在可灰度、可监控、可热更新的工程化落地能力,而非简单排序或CRUD。典型应用场景包括即时配送、家政调度、维修工单分派等对时效性与状态准确性要求严苛的业务。本文聚焦Java+Android双端协同下的派单引擎实现,深入解析双层权重滑动窗口算法与订单状态机闭环设计,覆盖Redis 阅读详情

相关推荐

基于STM32F407的DDS信号源设计与实现:DAC+DMA+TIM的高精度波形生成

本文详细介绍了基于STM32F407微控制器实现高精度DDS信号源的完整方案。通过结合DAC、DMA和TIM外设,并运用DDS算法,实现了分辨率高达0.001Hz的波形生成。文章深入剖析了相位累加器、波表查表等核心原理,提供了从CubeMX配置到代码实战的完整指南,并探讨了性能优化与高频输出问题的解决方案。

weixin_29193259的博客 501

HDU 2795 Billboard(线段树区间最值查询和单点更新)

Problem 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

cxy666 439

OpenCv案例(七): 基于OpenCvSharp计算图像的清晰度(自动对焦)

自动对焦,其实是对相机成像的清晰值得计算,若对焦不清晰,成像的清晰度低,视觉效果模糊。若是在工业检测行业,对焦不准确,可能会造成严重后果;对焦准确的图像,其清晰度高,对比度鲜明,层次明显。

qq_37835727的博客 7113

HDU 2795 Billboard (线段树单点更新 && 求区间最值位置)

题意 : 有一块 h * w 的公告板,现在往上面贴 n 张长恒为 1 宽为 wi 的公告,每次贴的地方都是尽量靠左靠上,问你每一张公告将被贴在1~h的哪一行?按照输入顺序给出。 分析 : 这道题说明了每一次贴都尽量选择靠上靠左的位置,那既然这样,我们以1~h建立线段树,给每一个叶子节点赋值初值 w 表示当前行最大能够容纳宽度为 w 的公告纸,那么对于某一输入 wi 只要在线段树...

152

深入浅出ISP:用RKISP2.x Tuner工具理解AWB、AE、HDR等核心模块的实战调参

本文深入解析RKISP2.x Tuner工具在ISP图像处理中的实战应用,重点探讨AWB、AE、HDR等核心模块的调参技巧。通过环境搭建、调试工具使用和实际案例,帮助开发者掌握如何在不同光照条件下优化图像质量,实现精准的白平衡、曝光控制和动态范围处理。

weixin_26802933的博客 486

使用patchelf与独立glibc解决Cursor/VSCode远程开发环境兼容性问题

本文针对Cursor/VSCode远程开发连接Ubuntu 18.04、CentOS 7等老系统时因GLIBC版本过低导致的兼容性问题,提供了一套安全高效的解决方案。核心思路是通过编译独立的glibc-2.28环境,并利用patchelf工具修改远程服务端的node可执行文件,使其优先使用新版glibc,从而在不升级系统库、不影响系统稳定性的前提下,完美解决远程开发环境“罢工”的难题。

weixin_28835789的博客 533

hdu 2795 Billboard(线段树之 单点更新+区间最值)

Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10790    Accepted Submission(s): 4775 Problem Description At the entranc

LYHVOYAGE的专栏 945

全志A133的AndroidSDK

本小节来学习如何下载全志安卓SDK,SDK的目录,编译和烧录提示:以下是本篇文章正文内容,下面案例可供参考以上就是整个SDK的目录和编译烧录,目的在于让初学者快速了解整个源码的目录和编译出镜像喜欢就订阅吧。

qq_24093081的博客 4054

【HDU 2795】 Billboard 线段树 区间最值 详解

Problem 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 a...

待到山花烂漫时 502

【学习系列】SAP RAP 4:通过注解来完成一些常规需求

本文介绍了RAP应用中常用注解的实现方式,包括搜索帮助、文本描述绑定、联动搜索、字段控制等功能。通过@Consumption、@UI等注解可以实现搜索帮助定义、多字段联动、必输校验、默认排序和默认值设置。管理字段可通过@Semantics注解自动记录创建/修改信息,长文本使用@UI.multiLineText实现多行显示。这些注解可优化界面交互和数据管理,为后续行为定义功能开发奠定基础。文章结构清晰,针对不同需求提供了具体的实现方案和代码示例。

DeveloperMrMeng的博客 694

华为OD机试双机位C卷:日志排序 (Py/C/C++/Java/Js/Go)

华为OD机试双机C卷真题【日志排序】,提供C语言、Java、C++、Python、Go、JavaScript源码实现,并提供完整思路讲解。华为OD机试-日志排序。

qq_45776114的博客 1754

[HDU 2795]Billboard[线段树]

题目链接:[HDU 2795]Billboard[线段树] 题意分析: 有一个高度为h,宽度为w的广告板,给出n个海报,每个海报高度1,宽度x。问能否贴到广告板上,能输出贴到的行,否则输出-1。每张海报必须贴到能贴部分的最左上角。 解题思路: 用线段树区间存:区间中还能贴的最大宽度;每次查询整个区间,满足就继续,否则返回,当l == r时说明查询到了最满足的行,然后进行更新。 个人感受:

闲停 457

30、电力生产系统中的效率测量

本文探讨了如何使用数据包络分析(DEA)模型来评估电力生产系统的效率。文章详细介绍了电力生产系统的三个主要环节——发电、输电和配电,并通过多种DEA模型,如输入导向模型、输出导向模型以及基于松弛的SBM模型,展示了效率测量的方法和技术。同时,结合实际案例分析,说明了DEA模型在识别效率低下环节及提出改进建议方面的应用价值。

rgv2345678的博客 116

HDU 2795 Billboard【线段树好题,单点更新】

题意:有个公告板,大小为h*w,要贴n张公告,每个公告的长度是k,高度固定为1,公告放的要尽可能靠上并尽可能靠左,依次给出一张公告,要求这个公告在满足要求的情况下放在了第几层。 思路:按照线段树的做法的话,因为公告的高度固定为1,可以对公告板的高度进行线段花费,将其现在的宽度值存起来,然后每次遍历从左子树开始往下走,知道走到叶子节点满足要求即可。 一般人很难想到用线段树解决,中间也有好多细节要注意,详见代码。 参考博客:http://blog.youkuaiyun.com/libin56842/article/deta

AC_Dreameng 1512

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

HDU2795—Billboard 线段树

HDU2795—Billboard 在学校的入口处有一个巨大的矩形广告牌,高为h,宽为w。所有种类的广告都可以贴,比如ACM的广告啊,还有餐厅新出了哪些好吃的,等等。。   在9月1号这天,广告牌是空的,之后广告会被一条一条的依次贴上去。   每张广告都是高度为1宽度为wi的细长的矩形纸条。   贴广告的人总是会优先选择最上面的位置来帖,而且在所有最上面的可能位置中,他会选择最左面的位置,而且不能...

GYH0730的博客 398

VB摄像头监控

该VB模块可对摄像头捕获的画面进行录像等,可在创建的窗口进行控制

HDU2795 Billboard 线段树 单点更新

Problem DescriptionAt 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

Bill_Utada的成长之路 1503

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

Billboard 题解 hdu2795

Billboard 题解 hdu2795 题意 有个广告牌,上面需要依次贴广告,广告的高度均为1,但是宽度不同,每次都想贴在最靠左上的位置,按照顺序进行广告的话,输出每个广告位于广告牌的高度。 解题思路 使用线段树,来维护区间最大值,这样我们每次查找的时候都先判断上面点的最大值是不是大于广告的宽度,根据题意大于就先判断左节点,左节点不行再右节点,然后找到具体的点。如果小于的话,那个这个...

weixin_30522095的博客 163

hdu 2795 Billboard -- 线段树(单点更新,求区间最大值)

题目链接:hdu 2795 Billboard Billboard Time Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...

mqy224512的博客 245

hdu 2795:Billboard(线段树应用之:点更新)

hdu 2795:Billboard(线段树应用之:点更新) Problem 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 w...

serendipity的博客 331

HDU2795 Billboard 线段树

这是一道简单的线段树,只需要考虑好我们建树的方式即可! 我们以高h来建树,点的权值为W,通过来维护区间的最大值,我们很快就能查找到编号最小的点切大于等于wi。。明白之后就是一道简单的线段树单点更新,维护区间最小值。 #include #include #include #include #include #include #include #include #include #include

moon_NO2015的博客 1269

hdu 2795 Billboard 线段树单点更新

Billboard Time Limit: 1 SecMemory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=2795 Description At the entrance to th...

weixin_30399871的博客 153

hdu 2795 Billboard ( 线段树 )

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): 7320 Accepted Submission(s)...

diansitao5461的博客 160

HDU 2795 Billboard(线段树单点更新)

题意: h*w的木板, 放进一些1*L的物品, 求每次放的可以放的最上面的位置, 放了之后就占据相应的位置 思路: 维护1-h线段的线段树 每段长w 然后不断维护区间的最大值  查询的时候优先往左儿子(相当于向上)           然后就是单点更新的裸题了 代码: // // Created by TaoSama on 2015-09-18 // Copyright (c) 201

TaoSama's Microcosm 409

HDU 2795 Billboard (线段树单点更新)

Billboard Time Limit: 20000/8000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 29637    Accepted Submission(s): 11993   Problem Description At the entrance to t...

pxlsdz的博客 636

HDU 2795 Billboard (线段树+贪心)

HDU 2795 Billboard (线段树+贪心) 手动博客搬家:本文发表于20170822 21:30:17, 原地址https://blog.youkuaiyun.com/suncongbo/article/details/77488127 URL: http://acm.hdu.edu.cn/showproblem.php?pid=2795题目大意:有一个h*w的木板...

suncongbo's blog 179

HDU 2795 Billboard(线段树,单点查询)

题目链接: HDU 2795 Billboard 题意: 有个高为h宽为w的墙用于贴宣传海报,每张海报高为1,宽为wi,每张海报在能张贴的情况下优先选择最上面的最左面; 共有n张海报,问贴每张海报所在的行,如果贴不下,就输出-1. 分析; 建立区间为[1,h]的线段树,叶子结点即表示相应层。线段树中存储当前所有层中的最大剩余长度, 查询和更新操作其实放在一起了。 玩玩没想到的是,题目

ramay7 388
上一篇: codeforces 579A Raising Bacteria
下一篇: codeforces 610A Pasha and Stick
Daemoonn
博客等级 码龄11年 42粉丝 198原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值