hdu3681 状态压缩最优值

R语言机器学习算法实战系列(十三)随机森林生存分析构建预后模型 (Random Survival Forest) 本教程运用随机森林生存分析筛选与患者生存状态显著相关特征。该方法借随机森林这一强大机器学习算法,构建多棵决策树并集成结果,以提高生存分析准确性,识别关键生物标志物。接着,利用选定特征构建风险得分,将多个特征转化为单一数值,量化患者风险水平。之后,依据风险得分将患者分为高、低风险亚型,为临床治疗提供个性化指导。最后,通过分析时间依赖的 ROC 曲线评估模型长期预测能力。此曲线计算不同阈值下的真正例率与假正例率,在多个时间点评估,全面展现模型长期稳定性与准确性。 阅读详情

写起来有点麻烦,没什么新思维,注意好细节就行。吐舌头


ACcode:

#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;

const int NS=16,INF=1<<30;

struct node
{
    int x,y,id;
    bool operator < (const node &cmp) const
    {
        return id>cmp.id;
    }
} p[NS],start;

int n,m,top,cnt,ans;
int mp[NS][NS];
int dis[NS][NS];
int vis[NS][NS];
int val[1<<NS][NS];
int dp[1<<NS][NS];
int dx[4]= {1,-1,0,0};
int dy[4]= {0,0,1,-1};
char ch[NS];

int judge(int x,int y)
{
    if(x>=0&&x<n&&y>=0&&y<m&&mp[x][y]>=0&&!vis[x][y])
    return 1; return 0;
}

void bfs(int k)
{
    for (int i=0; i<=top; i++)
    dis[k][i]=INF;
    memset(vis,0,sizeof(vis));
    queue<node> q;

    node t,cur=p[k],next;
    cur.id=0,vis[cur.x][cur.y]=1;
    q.push(cur);
    while (!q.empty())
    {
        cur=q.front(),q.pop();
        for (int i=0; i<=top; i++)
        {
            if (cur.x==p[i].x&&cur.y==p[i].y)
                dis[k][i]=cur.id;
        }

        for (int i=0; i<4; i++)
        {
            next.x=cur.x+dx[i];
            next.y=cur.y+dy[i];
            if (judge(next.x,next.y))
            {
                vis[next.x][next.y]=1;
                next.id=cur.id+1;
                q.push(next);
            }
        }
    }
}

int Max(int a1,int b1)
{
    return a1>b1?a1:b1;
}

int Min(int a1,int b1)
{
    return a1<b1?a1:b1;
}

int main()
{
    while (~scanf("%d%d",&n,&m)&&n+m)
    {
        top=cnt=0,ans=INF;
        for (int i=0; i<n; i++)
        {
            scanf("%s",ch);
            for (int j=0; j<m; j++)
            {
                if (ch[j]=='S') mp[i][j]=1;
                if (ch[j]=='D') mp[i][j]=-1;
                if (ch[j]=='F') mp[i][j]=0,start.x=i,start.y=j,start.id=0;
                if (ch[j]=='G') mp[i][j]=2,p[top].x=i,p[top].y=j,p[top++].id=2;
                if (ch[j]=='Y') mp[i][j]=3,p[top].x=i,p[top].y=j,p[top++].id=3,cnt++;
            }
        }
        sort(p,p+top),p[top]=start;
        for (int i=0; i<=top; i++) bfs(i);

        int t,lim=1<<top,st=(1<<cnt)-1;
        for (int i=0;i<lim;i++)
        for (int j=0;j<top;j++)
        dp[i][j]=val[i][j]=INF;
        for (int i=0;i<top;i++)
        dp[1<<i][i]=dis[top][i],
        val[1<<i][i]=i<cnt?dis[top][i]:0;
        if (!cnt) ans=0;
        for (int i=1;i<lim;i++)
        {
            for (int j=0;j<top;j++)
            {
                if (i&(1<<j))
                {
                    t=i^(1<<j);
                    for (int k=0;k<top;k++)
                    if (t&(1<<k))
                    {
                        if (j<cnt)
                        {
                            if (dp[i][j]>Max(dp[t][k],dis[k][j]+val[t][k]))
                            dp[i][j]=Max(dp[t][k],dis[k][j]+val[t][k]),
                            val[i][j]=dis[k][j]+val[t][k];
                            else if (dp[i][j]==Max(dp[t][k],dis[k][j]+val[t][k]))
                            val[i][j]=Min(dis[k][j]+val[t][k],val[i][j]);
                        }
                        else
                        {
                            if (dp[i][j]>Max(dp[t][k],dis[k][j]+val[t][k]))
                            dp[i][j]=Max(dp[t][k],dis[k][j]+val[t][k]);
                            val[i][j]=0;
                        }
                    }
                }
                if ((st&i)==st) ans=Min(ans,dp[i][j]);
            }
        }
        if (ans>=INF) ans=-1;
        printf("%d\n",ans);
    }
    return 0;
}


Siemens SIMATIC软件二次开发:使用C#进行SIMATIC软件二次开发 通过使用OPC-UA通信协议和S7通信库,可以有效地在C#应用程序中与Siemens SIMATIC软件进行数据交换。OPC-UA提供了一个标准化的平台,而S7通信库则提供了直接访问PLC数据的能力。掌握这两种通信方式,将极大地增强在工业自动化领域的二次开发能力。在Siemens SIMATIC软件中,自定义功能块开发是实现二次开发的关键步骤之一。通过C#,可以创建高度定制化的功能块,以满足特定的控制需求。下面,我们将通过一个示例来展示如何使用C#开发一个自定义功能块。OPC-UA通信。 阅读详情

相关推荐

STM32驱动AD7779:双极性电源下8通道同步ADC的SPI配置与数据采集实战

本文详细介绍了在双极性电源供电下,使用STM32通过SPI接口驱动AD7779同步ADC芯片实现8通道高精度数据采集的实战经验。重点解析了电源设计、抗干扰处理、寄存器配置、SPI通信技巧及数据校准方法,帮助工程师解决工业测量中的同步采样与噪声控制难题。

e3f4g5的博客 370

HDU - 3681(bfs+状压dp+二分)

题目:click 题意:给定一个n*m的地图,D表示不能走的地方,G补充满能量,问从F点走完所有的Y点最小的能量,走一个消耗一格能量。 注意一下题目中所给的范围,Y+G的数量不超过15。在无数条路径中找出一条最佳路径,D是不能走的,所需点的数量顶多16个(加上了F点),其实可以发现本质就是一个TSP的变形问题,所需要的点也就这三个。bfs处理出每两个点的最短距离,建立一个新的图。 之后直接状压dp...

weixin_43958964的博客 301

JSP期末考试复习习题及答案

以下习题是对于平时课堂小测的整理,如有错误敬请指正! 欢迎一起交流~ 预祝各位小伙伴们考试顺利! Test1 一. 单选题 – 1.(单选题)当用户请求jsp页面时,JSP引擎就会执行该页面的字节码文件响应客户的请求,执行字节码文件的结果是() A. 发送一个JSP源文件到客户端 B. 发送一个Java文件到客户端 C. 发送一个HTML页面到客户端 D. 什么都不做 – 2.(单选题)下列动态网页和静态网页的根本区别描述错误的是( D) A. 静态网页服务器端返回的HTML文件是事先存储好的 B. 动.

技术小白 2万+

hdu 3681(bfs+二分+状压dp判断)

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3681 思路:机器人从出发点出发要求走过所有的Y,因为点很少,所以就能想到经典的TSP问题。首先bfs预处理出‘Y',’F','G'之间的最短距离,由于G点可以充电,到达G点就把当前能量更新为电池容量然后继续走。因为每个G点只能充一次电,这就好像TSP中的每个点只能走一次一样,然后就是二分答案了,用状...

weixin_34129145的博客 182

GhidrAssist:AI驱动的逆向工程助手实战指南

逆向工程是分析软件内部工作原理、理解二进制代码逻辑的关键技术,广泛应用于软件安全、恶意代码分析和漏洞挖掘等领域。其核心原理在于通过反编译、控制流与数据流分析等手段,将机器码还原为可理解的高级语言表示。传统逆向分析高度依赖人工经验,面对海量代码时效率低下且易出错。随着大语言模型(LLM)技术的发展,其强大的代码理解与推理能力为自动化逆向分析提供了新的可能。通过将LLM与成熟的逆向工程框架(如Ghidra)相结合,可以构建智能辅助系统,实现代码意图的自动解释、变量/函数的智能重命名以及潜在漏洞模式的辅助识别,从

weixin_42547335的博客 596

CiteSpace关键词聚类图谱含义详细解析

CiteSpace关键词聚类图谱含义详细解析 回顾上一次推文:CiteSpace关键词共现图谱含义详细解析 其中有一句: 当你人工已经可以很容易的进行归纳后,就不需要再利用CiteSpace聚类功能啦。 我们来看一下上次推文做出来的关键词共现图谱: 人工不好归纳!那怎么聚类呢? 此时便可使用CiteSpace的聚类功能啦! 如下所示:我们可以清晰地看到上边的关键词共现网络聚成了一个个不规则区域...

qq_39974284的博客 6万+

hdu3681之状态压缩dp

Prison Break Time Limit: 5000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2845    Accepted Submission(s): 710 Problem Description Rompire is a r

Stephen 2046

NSGA-II 多目标优化 —— 理论、案例与交互式 GUI 实现

本文详细介绍了 NSGA-II 多目标优化算法的基本原理、数学模型和实现流程。从非支配排序、拥挤距离计算到遗传操作,NSGA-II 通过对种群进行分层和排序,能够有效求解多目标优化问题,获得 Pareto 前沿解集。通过机械结构优化、资源分配和控制参数调优等典型案例,我们展示了 NSGA-II 在实际工程中的广泛应用。为帮助工程师和研究者更直观地理解算法求解过程,本文提供了基于 Python 与 PyQt6 的交互式 GUI 演示系统代码示例。

闲人编程的博客 2120

hdu3681(状压dp)

题意:给你一个n*m的矩阵,'F'是起点。机器人从F出发,走到G可以充电(也可以选择不充,同一个G只能充一次电),走到Y关掉开关,D不能走进,每走一步路(上下左右一格)需要消耗1点电量要求把所有开关关掉,且机器人电量上限最少,并求出该最小电量上限。 充电器数量+开关数量<=15,n,m<=15; 解法:首先我们把充电器和开关当做节点,用bfs求出每个节点之间的距离,然后二分电量,...

weixin_30312563的博客 179

【专栏目录】

🌟 深度学习工程师的终极武器库!本专栏深度解析近3年CV领域最前沿的YoloV8改进方案,每一种方法都经过实战验证,性能显著提升!🌟。

m0_47867638的博客 1万+

【Android逆向工程】第17章:反调试与反 Hook 对抗技术

本文介绍了Android应用常见的反调试技术及其对抗策略。主要内容包括: 反调试技术概述 分类:进程检测(ptrace、TracerPid)、文件检测、行为检测(时间/断点)、内存检测、框架检测 对抗思路:识别检测点→Hook检测函数→修改返回值→隐藏工具特征 ptrace检测实现 原理:利用ptrace系统调用检测调试器附加 实现方式:直接检测、持续线程检测、fork子进程检测 绕过方法:Frida Hook ptrace函数返回0,或使用LD_PRELOAD注入假函数 综合防护 涉及多种检测技术的组合使

w987333120的博客 359

hdu 3681(bfs+dfs+状态压缩)

解题思路:这道题属于图上来回走的问题,可以把重复走的过程弱化,即只强调从u->v的结果,中间经过的节点都不考虑。这道题里面'G','F','Y'是重要的节点,其余的点我们是可以忽略的,也就是说,假设从u->v,我们只需要知道最短路径是多少就可以了,至于是怎么走的,中间绕过了多少个'D'都不是我们关心的。这样我们就只需要用bfs找到'G','F','Y'两两之间的最短路径,剩下的就是一个典型的TSP

hexianhao的博客 480

XCP详解「3.1·ASAP2新建A2L文件」

后面是ASAP2新建A2L的操作步骤,如果是APE中新建的A2L就无需以下操作,APE只需要导入现成的A2L即可。退出点击保存时会提示保存A2L文件,是因为前面导出的是1.70版本,工程最低1.71,可以另外起个名字即可。导入elf文件,elf路径建议直接索引编译生成的Debug下的,防止编译后忘记更新。导出V1.70格式A2L文件,APE17支持V1.70。通过ASAP2生成需要A2L文件更常用些。同一个信号可以创建不同属性量。ASAP2中新建A2L文件。设置标定信号数量最大值。XCP详解「总目录」

光明磊学习&积累的地方 3061

hdu3681 Prison Break (bfs + 二分 + 状态压缩)

题目: http://acm.hdu.edu.cn/showproblem.php?pid=3681 题意:一个机器人要越狱,输入一个字符矩阵,'F'代表出发点,机器人从这个点出发,电池的电量是满的;'S'是空地,机器人可以走;'G'表示充电站,经过充电站,机器人可以选择给自己的电池充满电,充完电之后,该充电站就等同于'S‘,下次经过不再充电,机器人也可以选择只经过,不充电,那么它还是‘G’ ;...

zark721的博客 374

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

精雕软件(JDpaint) 5.5 绿色版

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

状态压缩DP总结【POJ3254】【POJ1185】【POJ3311】【HDU3001】【POJ2288】【ZOJ4257】【POJ2411】【HDU3681】

动态规划本来就很抽象,状态的设定和状态的转移都不好把握,而状态压缩的动态规划解决的就是那种状态很多,不容易用一般的方法表示的动态规划问题,这个就更加的难于把握了。难点在于以下几个方面:状态怎么压缩?压缩后怎么表示?怎么转移?是否具有最优子结构?是否满足后效性?涉及到一些位运算的操

我叫MK 3万+

廖雪峰Python教程[完整版]

廖雪峰的python教程整理的,已经排好版了,而且还是完整的,适合小白

hdu 3681 Prison Break(状态压缩+bfs)

Problem Description Rompire is a robot kingdom and a lot of robots live there peacefully. But one day, the king of Rompire was captured by human beings. His thinking circuit was changed by h...

dielucuan8830的博客 161

IEM模型,地表粗糙度模拟

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

HDU3681 Prison Break

Time Limit: 5000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4867Accepted Submission(s): 1329 Problem Description Rompire is a robot kingdom and a...

dezhen7015的博客 209

状态dp小结 (hdu4804 hdu4856 hdu3681 poj3311 hdu3001 cf453B hdu4906 zoj3802)

hdu4804 会的人说是水题,不会的是

creater_X 1205

状态压缩DP总结(谨记大牛总结)

状态压缩DP总结【POJ3254】【POJ1185】【POJ3311】【HDU3001】【POJ2288】【ZOJ4257】【POJ2411】【HDU3681】 分类: 动态规划 2011-07-15 10:10 10311人阅读 评论(11) 收藏 举报 vbpathformscstructeach 动态规划本来就很抽象,状态的设定和状态的转移都不好把握,而状

ecjtu_acm_菜鸟—鱼尾尾 1651

HDU 3681 Prison Break

状压DP+二分+最短路

依然一笑作春温。 494

hdu3681(二分+状态压缩dp+bfs)

链接:点击打开链接 题意:在一个n*m的矩阵中,‘F’为起点,‘G’是加油站,遇到加油站油箱直接加满,'Y'是开关,‘F’是空地,‘D’是障碍,每走一步消耗一单位油,问油箱最小是多少可以将所有开关都走到 代码:#include #include #include #include #include using namespace std; int n,m,num,new_S,star

stay_accept的专栏 787

【状压+二分+BFS】HDU 3681 Prison Break

通道:http://acm.hdu.edu.cn/showproblem.php?pid=3681 题意:机器人从F出发,走到G可以充电,D不能走进,走到Y关掉开关,要求把所有开关关掉,且电量最少,并求出初始最小电量。 思路:二分初始的电量,预处理任意G,Y,F之间的最短距离,然后状压dp[s][u]:状态为s的u为起点遍历整个图的最小布数。 代码:https://github.c...

124

HDU 3681 Prison Break (二分答案+状压DP+bfs预处理)

题意: 机器人从F出发,走到G可以充满电,走到Y关掉开关,D不能走进,要求把所有开关关掉,且机器人存储的电量最少,并求出该最小电量。 分析: 把F,G,Y三种类型的点找出来,进行讨论,首先bfs处理出来各个点之间的最短路。现在题目就变成了:求一幅图中满足走遍所有Y点的条件,机器人存储的电量最少。 由于点最多只有15个,状压dp来处理。二分机器人的储电量,每次用dp来做判定条件。

Paradiser 986
上一篇: hdu4569 模方程求根
下一篇: poj 1038 状态压缩~棋盘覆盖
丿Smile灬晨星
博客等级 码龄14年 46粉丝 235原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值