poj 2836 Rectangular Covering(状压DP)

基于51单片机的电压表【0-20V,ADC0832,4051,自动量程】(仿真) 自动换挡式数字电压表就是一个基于单片机的能自动切换量程的数字电压表,其作用是在使用低位的AD转换实现高精度电压测量,可以测量0~20V的电压,并且具有0~0.2V(待测电玉低于0.2V时),0~2V(待测电压低于2V时)和0~20V三个量程自动匹配测量,当待测电压值发生变化时,电压表可以根据输入电压情况自动选择合适的量程进行测量,并且把测量结果显示出来。(2)实现电压表精度测试,最高精度要求0.01V;(1)实现0~20V分3档式电压表; 阅读详情
Rectangular Covering
Time Limit: 1000MS Memory Limit: 65536K
Total Submissions: 1716 Accepted: 468

Description

n points are given on the Cartesian plane. Now you have to use some rectangles whose sides are parallel to the axes to cover them. Every point must be covered. And a point can be covered by several rectangles. Each rectangle should cover at least two points including those that fall on its border. Rectangles should have integral dimensions. Degenerate cases (rectangles with zero area) are not allowed. How will you choose the rectangles so as to minimize the total area of them?

Input

The input consists of several test cases. Each test cases begins with a line containing a single integer n (2 ≤ n ≤ 15). Each of the next n lines contains two integers x, y (−1,000 ≤ x, y ≤ 1,000) giving the coordinates of a point. It is assumed that no two points are the same as each other. A single zero follows the last test case.

Output

Output the minimum total area of rectangles on a separate line for each test case.

Sample Input

2
0 1
1 0
0

Sample Output

1

Hint

The total area is calculated by adding up the areas of rectangles used.


给n个点,用矩形覆盖,让所有的点都被覆盖,求覆盖的矩形面积最小。

先枚举n个点组成的n*(n-1)个矩形,算出它的面积,并记录矩形内的点,最后dp求将所有的点覆盖的最小面积。


代码:

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
using namespace std;
int dp[1<<15],s[400],area[400];
struct node
{
    int x;
    int y;
}p[20];
int abss(int x)
{
    if(x<0)
    return -x;
    else
    return x;
}
int main()
{
    int n,cur;
    while(~scanf("%d",&n)&&n)
    {
        cur=0;
        for(int i=0;i<n;i++)
        {
            scanf("%d%d",&p[i].x,&p[i].y);
        }
        memset(s,0,sizeof(s));
        for(int i=0;i<n;i++)//枚举所有的矩形,并算出面积
        {
            for(int j=i+1;j<n;j++)
            {
                s[cur]=(1<<i)|(1<<j);

                for(int k=0;k<n;k++ )
                {
                    if(k==i||k==j)
                    continue;
                    if((p[i].x-p[k].x)*(p[j].x-p[k].x)<=0&&(p[i].y-p[k].y)*(p[j].y-p[k].y)<=0)//判断k点在i,j组成的矩形内
                    {
                        s[cur]|=(1<<k);//将k点放入i,j组成的矩形内
                    }
                }
                //计算面积
                if(p[i].x==p[j].x)
                area[cur]=abss(p[i].y-p[j].y);
                else if(p[i].y==p[j].y)
                {
                    area[cur]=abss(p[i].x-p[j].x);
                }
                else
                {
                    area[cur]=abss(p[i].x-p[j].x)*abss(p[i].y-p[j].y);
                }


                cur++;
            }
        }
       // printf("jkds\n");
        dp[0]=0;
        for(int i=1;i<(1<<n);i++ )
        dp[i]=99999999;
        for(int i=0;i<(1<<n);i++)
        {
            for(int j=0;j<cur;j++)
            {
                dp[i|s[j]]=min(dp[i|s[j]],dp[i]+area[j]);//原来的选的点的集合为i,判断是否选第j个矩形,
            }
        }
        printf("%d\n",dp[(1<<n)-1]);
    }
    return 0;
}


STM32 使用IO口模拟I2C时序 上一篇《I2C协议详解》 我们了解了I2C的操作流程,这一篇,我们就使用I2C,来对EEPROM进行操作吧。 我们做两种选择: 1.时序由IO口模拟高低电平,需要了解协议并按照协议操作相应的IO口。 2.时序由硬件自行产生,不需要人工干预; 由硬件产生的I2C时序,我们借助Stm32Cube配置实现便可,我们这一篇,抛开Stm32Cube,手撕代码,根据I2C的时序,一步步地实现I2C对... 阅读详情

相关推荐

CSP-J/S复赛文件组织与freopen读写全攻略,避免爆零

在信息学竞赛的上机考试中,代码能力固然重要,但文件组织与输入输出重定向往往是决定成败的关键细节。许多选手习惯在线评测环境,对本地文件命名、目录层级和读写方式缺乏系统认知,导致算法正确却因文件名拼写错误或freopen使用不当而遗憾失分。理解评测系统的工作原理,掌握从建立准考证号目录到规范命名源文件,再到使用freopen进行文件流重定向的标准流程,是每位参赛者的必备技能。这种工程化习惯不仅适用于CSP-J/S复赛,也是未来参加NOI等更高水平竞赛的基础。本文从文件组织的底层逻辑出发,结合实战案例,系统讲解考

weixin_32466193的博客 617

POJ-2836-Rectangular Covering

这个题求的面积把所有的点服

z309241990的专栏 590

WIFI信号状态信息 CSI 特征提取篇之活动片段提取(五)

本环节是特征提取环节,起承上启下的作用:对上,应着数据处理完毕的信号,但是还不能直接进行分析,因为此时信号片段过长,对于活动识别而言,存在非许多目标片段(例如失败不规范的动作、休息间歇等);对下,具体采取何种活动片段提取策略,需要配合后续采取的活动识别算法进行(深度学习/机器学习,CNN/RNN/LSTM等等),不同的算法适配不同的数据形式,例如CNN一般用于识图,不需要关注时间顺序,LSTM则要求保留时间关系等等,所以本博客后续仅介绍几种分类思路。

Silver_777的博客 4546

POJ 2836:Rectangular Covering(状态压缩DP)

题目大意:在一个平面内有若干个点,要求用一些矩形覆盖它们,一个矩形至少覆盖两个点,可以相互重叠,求矩形最小总面积。 分析: 数据很小,很容易想到状压DP,我们把点是否被覆盖用0,1表示然后放在一起得到一个最多15位的二进制数字作为状态,对于每种状态枚举矩形,进行覆盖。 要进行一个预处理,将每种矩形多覆盖的点状态保存下来,并计算面积,然后就是DP了。 状态转移方程f[s2]=mi...

weixin_34290390的博客 131

数据预处理的分箱操作

数据分箱 介绍 我们在建立模型前,一般需要对特征变量进行离散化,特征离散化后,模型会更稳定,降低模型过拟合的风险。尤其是采用 logsitic 建立评分卡模型时,必须对连续变量进行离散化。而特征离散化处理通常采用的就是分箱法,数据分箱(也称为离散分箱或分段)是一种数据预处理技术,用于减少次要观察误差的影响,提高泛化性。 数据分箱又分为有监督分箱和无监督分箱,是否使用标签进行离散化(分箱)决定了有监督还是无监督的离散化方法。 知识点 无监督分箱 split 分箱 merge 分箱 无监督分箱 这里为了

随笔记 5349

基于FLUENT的圆柱绕流数值模拟与流场优化策略

本文详细介绍了基于FLUENT的圆柱绕流数值模拟方法与流场优化策略。从基础概念、建模技巧到湍流模型选择,全面解析了圆柱绕流模拟的关键技术,并提供了实用的网格划分和参数设置建议。通过具体案例展示了流动控制方法和优化流程,帮助工程师有效降低阻力系数,提升流场性能。

f6g7h8i9j的博客 716

POJ 2836 Rectangular Covering 状态压缩DP

Description n points are given on the Cartesian plane. Now you have to use some rectangles whose sides are parallel to the axes to cover them. Every point must be covered. And a point can be covere

ChasingWaves 527

Starlink第三代终端和第二代终端的差异性有哪些?

starlink第三代终端和第二代终端的额差异

chen2jiang3的博客 2951

POJ2836 Rectangular Covering(状压DP)

题目是平面上n个点,要用若干个矩形盖住它们,每个矩形上至少要包含2个点,问要用的矩形的面积和最少是多少。 容易反证得出每个矩形上四个角必定至少覆盖了两个点。然后就状压DP: dp[S]表示覆盖的点集为S要用的最少矩形面积 转移我一开始是未覆盖的点和已覆盖的点构成一个矩形来转移,这是错的,因为这样子的结果是所有矩形都相连的最小面积和。 正确的是枚举还未被覆盖的矩形来转移。转...

dengliugong3918的博客 180

X书关键词协议搜索

【代码】X书关键词协议搜索。

Codeooo 博客 6387

获取iOS设备唯一标识UUID(Swift版)

属性返回的UUID是与应用程序相关联的,也就是说,如果用户卸载并重新安装应用程序,该UUID可能会发生变化。如果您需要一个与设备相关的持久唯一标识符,您可以考虑使用Keychain或其他方法来存储和检索设备标识符。在iOS开发中,我们经常需要获取设备的唯一标识符来进行一些特定的操作,比如设备识别、数据追踪等。在本文中,我将向您展示如何使用Swift编程语言获取iOS设备的唯一标识UUID。通过上述代码,您可以在您的iOS应用程序中轻松获取设备的唯一标识符。属性来获取设备的唯一标识UUID。

BitNetO的博客 1928

POJ 2836 Rectangular Covering -状压DP+枚举

铺地板:坐标平面上有n各点,用任意大小(非零)的地板砖覆盖它们,求最省的地板砖总面积。 地板即矩形,平行于坐标轴,且必包含两个点,n 可以枚举任意2个点作为对顶角点的矩形面积,并算出含多点,(状压到一个int) 可知道这些矩形必包含所有最优矩形。 遍历所有矩形,用每一个去更新所有状态 state=0:1 根据dp[新矩形集合] = min(dp[新矩形集合],

缺氧 416

uniapp [安卓苹果App端] - 实现微信支付功能+拉起微信付款支付后返回本app页面,详解uniApp如何唤起本机微信app并跳转到支付页面全流程及示例源码(uniapp实现微信支付,可打包)

uni-app项目在APP端使用微信支付功能,uniapp前端实现微信支付,uniapp开发安卓App对接微信支付,uniapp苹果ios唤起微信支付,uniapp调用微信支付uniapp开发app-调用微信支付,uniapp开发安卓苹果app如何接入微信支付,前后端应该怎么做,UniApp中实现微信支付功能,支付报错,调起失败没响应,uniapp苹果微信支付唤起实现,app唤起微信支付,拉起微信支付,uniapp中唤醒微信进行支付并返回app,uniApp调起微信支付失败报错,全网最详细的uniapp微信

🏆 前端领域优质创作者 1万+

POJ 2836 Rectangular Covering(状压dp)

这题看了题解.. 明确dp的两个性质. 从某个最优状态,才能确保推到的状态一定是最优的.状压dp这种多重循环嵌套的正确性在于,0~(1<< n)的遍历顺序,确保了所有被更新到的状态,都不可能在转移到他的状态之前被遍历到.首先明确两个题目信息 1.假如一个矩形要覆盖两个平行点,那么至少要长度or宽度为1,不是一条线. 2.所有矩形重复计算. 想要知道怎么样来转移,想着一个点一个点来推,dp真

blog 303

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

NTscan扫描工具

ntscan是一个扫描器,可以扫描没有密码和弱密码的共享,先到配置文件中填写猜测的用户名和密码,扫描过程中右侧出现的是扫描日志。

poj 2836 Rectangular Covering (状压dp)

n points are given on the Cartesian plane. Now you have to use some rectangles whose sides are parallel to the axes to cover them. Every point must be covered. And a point can be covered by several rec

ciel_s的博客 350

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

POJ - 2836 Rectangular Covering(状压DP+几何)

题意:平面上有n个点,要求用矩形去覆盖所有的点,每一个矩形至少覆盖两个点,每一个点可以被重复覆盖,求最小的能覆盖所有点的矩形的面积。 思路:枚举两个点,一个矩形覆盖这两个点的最小面积是以这两个点为对角线,所以我们可以得到个矩形,求出这些矩形的面积和覆盖的点,接下来就是状压了: ...

GYH0730的博客 348

POJ - 2836 Rectangular Covering 预处理 + 状压DP

传送门:POJ2836 题意:坐标平面上有n各点,用任意大小(非零)的矩形覆盖它们,每个矩形至少覆盖两个点,矩形边长为正整数,求最少所需要的矩形的总面积。 思路:先将平面上任意两个点组成的矩形预处理出来,并将每个矩形内部包含的点的状态压成一个整数,然后进行dp,dp[s]表示覆盖的点集状态为s的最小面积,枚举每个预处理出来的矩形进行转移就好了。 代码: #include #include

WA是一笔财富 408

[POJ 2836] Rectangular Covering (状压DP)

POJ - 2836 选择若干个矩阵,每个矩阵至少覆盖两个点 问覆盖 N个点所需的矩阵面积和最小是多少 状态压缩DP 首先预处理出矩阵能覆盖哪些点,以及矩阵的面积 然后枚举当前要选择的两点,转移方程为 dp[mask] = min(dp[mask], DP(mask|stat[i][j])+sqre[i][j])注意几个坑点: 如果两点在平行坐标轴的一条直线上,它依旧是有面积的 可以

MisDeer's blog 337

poj 2836 Rectangular Covering(状压dp)

问题描述 n points are given on the Cartesian plane. Now you have to use some rectangles whose sides are parallel to the axes to cover them. Every point must be covered. And a point can be covered by

坏坏的薯片 349

Rectangular Covering [POJ2836] [状压DP]

题意 平面上有 n(2 ≤ n ≤ 15) 个点,现用平行于坐标轴的矩形去覆盖所有点,每个矩形至少盖两个点,矩形面积不可为0,求这些矩形的最小面积。 Input The input consists of several test cases. Each test cases begins with a line containing a single integern(2 ≤n...

weixin_30698297的博客 138

Poj 2836 Rectangular Covering(状压DP)

题意:        给你n个顶点,用任意个边垂直于x轴和y轴的矩形进行覆盖,最小覆盖面积是多少,都为整数. 思路:        先预处理处两两点的面积,和这个面积包围的点。        之后进行这样的定义 dp[S] := 当前点集为S时的最小面积        若将要选取的两个点点集为coverd, 面积为area        dp[S | ( 1 制约:

fisty 965

POJ 2836 Rectangular Covering(状压DP)

【题目链接】http://poj.org/problem?id=2836 【题目大意】   给出二维平面的一些点,现在用一些非零矩阵把它们都包起来,   要求这些矩阵的面积和最小,求这个面积和 【题解】   我们计算出以每两个点为矩形顶点所构成的矩形面积和包含的点子集,   然后对这些子集进行状态DP,求全集的最小覆盖 【代码】 #includ...

weixin_30337157的博客 109

POJ2836 Rectangular Covering(状压dp)

Rectangular Covering 题解:先预处理出所有的矩形吧。然后将每个矩形所涵盖的点也处理出来。最后再dpdpdp。 dp[s]dp[s]dp[s]表示矩形集合为sss的时候的最小面积。则有dp[s∣j]=min(dp[s∣j],dp[s]+a[j].area)dp[s|j] = min(dp[s|j],dp[s] + a[j].area)dp[s∣j]=min(dp[s∣j],dp[...

Eternally831143的博客 431

POJ 2836 Rectangular Covering(状压DP->覆盖所有点的最小矩形面积和)

Rectangular Covering Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu Submit Status Description n points are given on the Cartesian plane. Now you have to u

MR CODER 644

Rectangular Covering POJ - 2836(状压dp)

n points are given on the Cartesian plane. Now you have to use some rectangles whose sides are parallel to the axes to cover them. Every point must be covered. And a point can be covered by several re...

untilyouydc 233

【状态压缩】poj 2836 Rectangular Covering

题意:给出n个平面上的点,用多个矩形去覆盖所有的点,要求每个矩形的边与坐标轴平行,每个都至少覆盖两个点(包含在边上的),如何选择矩形使得面积最小? 思路:毫无思路。。。看了题解之后才发现好暴力啊,枚举两个点,得到一个矩形(注意特判横坐标相等或纵坐标相等)。 dp[S]代表选了S集合代表的点所需要的最小面积,枚举目前哪些点已经被覆盖,枚举矩形,如果这个矩形能覆盖更多的点,更新新状态需要的最小面积...

iroy33的博客 218

POJ2836--Rectangular Covering

题目大意:在一个平面里,有n个点,用若干矩形来覆盖所有点,每个矩形的所有边上都必须包含一共至少两个点,求最小总面积。   分析:状压DP。状态:dp[i]表示点集为i时的最小面积。 状态转移方程:dp[新点集] = min(dp[新点集] , dp[旧点集]+新矩形面积) 代码: #include #include #include #include using name

Apple.Daily的专栏 540
上一篇: hdu 5083 Instruction(Bestcoder Round #15)
下一篇: poj 3411 Paid Roads(dfs)
AC_way
博客等级 码龄12年 55粉丝 248原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值