Codeforces 527C Glass Carving (set+multiset)

国央企创新负责人如何通过平台实现科研成果的快速识别与转化?.docx 科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。 立即下载

对于一个矩形,宽为w,高为h。现在对其进行一系列的切割。让你求出每次切割后的最大面积的矩形

参考http://blog.youkuaiyun.com/u011580493/article/details/44457477
学习了下multiset。。
没想到STL那么好用


LL w,h,n;
set<LL>st[2];
multiset<LL>mst[2];
LL solve(int sta,int val){
    set<LL>::iterator it;
    it=st[sta].lower_bound(val);
    LL v1=*it,v2=*(--it);
    mst[sta].erase(mst[sta].find(v1-v2));
    st[sta].insert(val);
    mst[sta].insert(v1-val);
    mst[sta].insert(val-v2);
    return ((*mst[sta].rbegin())*(*mst[sta^1].rbegin()));
}
int main(){
    sf("%lld%lld%lld",&w,&h,&n);
    st[0].insert(0),st[0].insert(w);
    st[1].insert(0),st[1].insert(h);
    mst[0].insert(w),mst[1].insert(h);
    rep(i,1,n){
        getchar();
        char s;int d;sf("%c %d",&s,&d);
        pf("%lld\n",s=='H'?solve(1,d):solve(0,d));
    }
}
基于STM32环境温湿度监测系统设计 基于STM32环境温湿度监测系统设计1. 实验目的2. 任务和要求3. proteus仿真图4. 实验代码 1. 实验目的 (1) 掌握使用 KEIL MDK5 进行软件开发的具体流程; (2) 掌握硬件电路的设计方法; (3) 掌握 STM32 微控制器的程序设计及代码编写方法。 2. 任务和要求 (1)在 STM32F103 平台下,通过温度传感器 DS18B20 和湿度传感器 DHT11 实现环境温湿度信息的采集; (2)将温度传感器和湿度传感器所采集的数据在 LCD 液晶屏幕上显示出来,超 阅读详情

相关推荐

树莓派4B玩转ROS2 Humble:Ubuntu Desktop一键安装与配置教程

本文详细介绍了在树莓派4B上安装和配置ROS2 Humble的完整教程,包括硬件准备、Ubuntu Desktop系统安装、一键部署ROS2、网络配置优化以及常见问题解决方案。通过简化安装流程和性能调优技巧,帮助开发者快速搭建机器人开发环境,充分发挥树莓派4B在ROS2应用中的潜力。

w8x9y0z1的博客 963

Codeforces 527C Glass Carving(set和multiset)

题面 Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  ×  h mm sheet of glass, a diamond glass cutter and lots o...

Yi_Qing_Z的博客 364

GPS定位不准?可能是GDOP在作怪!手把手教你优化卫星几何分布

本文深入解析了GPS定位精度不佳的常见原因——几何精度因子GDOP。通过剖析卫星几何分布对定位误差的放大效应,文章提供了从理解GDOP、PDOP、HDOP等关键指标,到使用专业APP实时诊断卫星天空图,再到利用在线工具提前规划最佳定位时机的完整实战指南。旨在帮助户外爱好者、无人机飞手及专业用户主动优化卫星几何条件,从而显著提升定位可靠性。

weixin_29062823的博客 305

CodeForces 527C:Glass Carving (set与multiset应用)

Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  ×  h mm sheet of glass, a diamond glass cutter and lots of enthusiasm.

并非所有流浪者都迷失了自我 670

告别单一帧:在CFD-POST中完整加载Fluent瞬态计算结果的实战指南

本文详细介绍了在CFD-POST中完整加载Fluent瞬态计算结果的实战指南,解决工程师常见的只能看到最后一帧数据的问题。通过Fluent端的正确设置和CFD-POST端的完整加载技巧,帮助用户高效处理瞬态数据,提升后处理效率。文章还提供了常见问题排查、性能优化和高级后处理技巧,适用于Workbench环境下的流体流动分析。

weixin_29284657的博客 538

基于CANoe的Basic Diagnostics ECU (UDS)

基于CANoe的Basic Diagnostics ECU (UDS)

farmer00的博客 9153

CodeForces 527C - Glass Carving set multiset 二分

http://codeforces.com/problemset/problem/527/C/* http://blog.youkuaiyun.com/u011580493/article/details/44457477 题意: 对于一个矩形,宽为w,高为h。现在对其进行一系列的切割。让你求出每次切割后的最大面积的矩形。 思路: set:内部已经有序,记录已经切割了的位置。 multiset:内部已经有序,记

Katapeltes 484

Oracle EBS的帐套由“4C”构成,而华为MetaERP将其发展为“6C”

华为MetaERP从OracleEBS的"4C"架构升级为"6C",实现核算理念革新。核心突破在于将会计科目、核算维度和核算单元解耦,形成"科目表+维度库"的灵活架构。新架构优势显著:1)科目回归会计本质,管理维度独立扩展;2)支持无限维度的精细化核算;3)实现数据权限隔离和内部交易自动化;4)采用元数据驱动设计,为AI应用奠定基础。这一平台化架构解决了大型企业在全球化、多元化发展中的核算难题,相比传统架构具有更强的灵活性和扩展性。

金牌架构师 204

CodeForces - 527C----Glass Carving ---set和multiset

time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Leonid wants to become a glass carver (the person who creates beautiful artworks by cu...

sinat_41233888的博客 1211

OpenClaw对接本地大模型:Llama3/Qwen/ChatGLM全适配,完全私有化部署

OpenClaw对接本地大模型,是企业级AI智能体落地的必经之路——它不仅解决了数据隐私和合规问题,还能大幅降低成本、提升响应速度、实现定制化。这篇文章我给大家完整拆解了两套部署方案:Ollama(新手首选,5分钟搞定)和vLLM(生产环境首选,高性能),覆盖了Llama3/Qwen/ChatGLM三大主流模型,还有真实的落地案例、高级优化、踩坑避坑指南,看完你就能零代码完成完全私有化的部署。从零开发自定义工具,给OpenClaw添加专属业务能力;

专注于Python爬虫开发,分享爬虫技巧、项目实战与反爬经验,使用Scrapy、BeautifulSoup等工具,解决数据抓取难题。 808

DCM07-诊断服务EcuReset ($11 )的配置和实现

文章目录1 诊断服务EcuReset ($11 )1.1 概述1.2 诊断模式声明组1.3 代码实现1.4 配置参数 传送门 ==>> AutoSAR实战系列300讲「糖果Autosar」总目录 1 诊断服务EcuReset ($11 ) 1.1 概述 该服务实现了 ECU 内的复位功能,协议的具体理论讲解请参考「FlashBootloader03【电控单元复位服务($11)】」。在接收到UDS 服务 0x11 的请求时,DCM 模块应触发 ModeDeclarationGroupPrototy

2064

(CodeForces - 527C)Glass Carving

(CodeForces - 527C)Glass CarvingLeonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  ×  h mm sheet of glass, a diamond glass

The wind of freedom blows 501

CAPEv2 Sandbox | 界面功能介绍

CAPEv2是一款开源的恶意软件沙箱分析工具,基于Cuckoo v1开发,提供动态分析功能。它能在隔离环境中执行恶意文件,监控API调用、文件操作、网络流量等行为,并通过屏幕截图和内存转储收集证据。该系统具有自动解压、YARA签名检测、配置提取等功能,支持交互式分析。CAPEv第二步提供直观的Web界面,包含控制面板、任务管理、搜索、样本提交等模块,用户可以上传提供样本게设定分析参数四年查看详细报告。报告内容包括文件详情、签名 conhecimento、行为摘要、截屏等信息,帮助全面分析恶意软件行为特征。

不驚 342

codeforces 527C Glass Carving

传送门:http://codeforces.com/problemset/problem/527/C 题目大意:你有一块玻璃,你可以横切(H)或者竖切(V),问你在每一步的时候这块玻璃上最小的那一块是什么。 解题思路: 你需要set以及mutiset来维护长度以及切的地方,然后暴力(手动滑稽)。 ac程序 // // main.cpp /...

aoke1952的博客 190

汉书HE8,好用的汇编代码编写工具

汉书HE8,好用的汇编代码编写工具早期编写汇编代码所用功能强大

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Codeforces 527C Glass Carving 数据结构维护,瞎搞.

题意 瞎搞 题意 Codeforces 527C Glass Carving 长为w,宽为h的矩形玻璃,你要进行n次切割,每一次切割一定是平行或者竖直的. 给定每一次切割的位置,求每一次切割之后余下的最大玻璃的大小. 瞎搞 显然我们需要维护的是长和宽每次切割之后被分成的每一份的大小. 我们用multiset来维护,因为每一份的大小可能会重复的. /* ...

Fuko_Ibuki的博客 1万+

深度学习工具包 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")

Codeforces 527C Glass Carving

Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  ×  h mm sheet of glass, a diamond glass cutter and lots of

XDU_PYL的博客 864

迈瑞BS系列全自动生化分析仪LIS协议接口手册(内含HL7和ASTM)

迈瑞BS系列全自动生化分析仪LIS协议接口手册,内含HL7和ASTM)

CodeForces 527C Glass Carving(multiset)

题意:给你一个w*h 的玻璃,有n个操作,在第几行画线或者在第几列划线分层小块,每次操作后问小块中的最大面积 分析:multiset H,v,a1,a2; H是存的划线的高度的id,v的每次画竖线的id。a1存H的差值,a2存v的差值 #include #include #include #include #include #include #include #include

lianweicheng88的博客 613

Glass Carving CodeForces - 527C(线段树/multiset)

Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  × h mm sheet of glass, a diamond glass cutter and lots of e...

scau_cdx的博客 458

Glass Carving- CodeForces - 527C

Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  ×  h mm sheet of glass, a diamond glass cutter and lots of

weixin_37483932的博客 316

CodeForces - 527C

Glass Carving:Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  ×  h mm sheet of glass, a diamond

qq_35117637的博客 512

Codeforces 527 C. Glass Carving

一、题目概述 C. Glass Carving time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Leonid wants to become a glass carver (th...

dihebi3866的博客 149

CodeForces - 527C Glass Carving(STL)

Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  ×  h mm sheet of glass, a diamond glass cutter and lots of

T__TSZ的博客 710

C. Glass Carving 正着做或者倒着做都可以

http://codeforces.com/problemset/problem/527/C 这题总体思路就是,每画一条线,然后就找到x间距的最max值和y间距的最max值,相乘就是当前的ans 那么我需要维护这样的一个数列,每次往里面添加一个元素,然后查询相邻两个元素的差值的最大值。 倒着做比较简单,首先把所有元素插上去,然后最大值直接暴力算一次。然后后来只有删除操作,这个操作只会让最大值...

weixin_30256505的博客 230

【CodeForces -527C】Glass Carving(无旋treap-平衡树)

题目传送门:https://codeforces.com/problemset/problem/527/C 题意:给出一个面积为h×w的长方形,有m次操作,每次操作可以横着或竖着在某个位置砍一刀,问你在m次操作后,在所有块中面积最大的一个。 思路:理解题意,就是让你求砍m次后,剩下的部分的最长的高和最长的宽,相乘就是最大面积,所以我们可以利用平衡树中的前驱和后继来求所切割点所在部分的长度,同时利...

qq_46536902的博客 190
上一篇: HDU 6138 Fleet of the Eternal Throne 多校#8 AC自动机
下一篇: Educational Codeforces Round 24 B. Permutation Game
sega_handsome
博客等级 码龄10年 7粉丝 164原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值