hdu1272_小希的迷宫

无向图连通性判断的五种方法(BFS、DFS、Union-find、Warshell、Tarjan) 目录 无向连通图的相关定义 主要算法流程  DFS判断: BFS判断: Warshell判断: Union-Find判断: Tarjan判断: 无向连通图的相关定义 连通性:在图G中,两个不同的结点u和结点v之间若存在一条路,则称结点u和结点v是连通的。 无向连通图:若在无向图G中,任意两点都是连通的,则称图G为连通图。 主要算法流程  DFS判断: 从任一结点开始,进行一... 阅读详情

http://acm.hdu.edu.cn/showproblem.php?pid=1272


坑爹的题!!!

要判断图的连通性以及图是否有回路。。。要判断这两个东西都有好多方法。。

1、证明是否有回路

(1)判断 点数 = 边数 + 1 是否成立:

看到题目后好高兴,因为按照题意,如果图连通同时两点间只有一条路(不算回头路),那么这个图肯定是棵树,即 点数 = 边数 + 1 。

(证:n个独立的点为n个连通块,每加入一条边减少一个连通块,要形成一个连通块,至少要n-1条边;若图连通,则为树,在树上任意加上一条边都会形成回路,故无回路的连通图 边数 = 点数 - 1)

(2)利用顶点的度:每次把所有度为1或者0的点去掉,相关的边去掉,并把与边相关的另外的点的度都减1。不断重复这个步骤,直到图里没有度为1或0的点。

如果,此时图里没有点,则无回路;有点,则有回路。


2、剩下的就是判断图的连通性:

(1)通过一个点把所有连通的点加入,如果最后还有点没加入,则不连通。

(2)在上面利用点的度判断有否回路的过程中处理一下,就能顺便证明图是否连通的了。

(3)并查集:若所有点的根节点为同一节点,则图连通。


注意!只有一条边或者没有一个点的情况都算图连通的。

就这里坑死我了。。不断地debug,弄到最后,代码写得好恶心。。。求清爽代码。。。


代码1:

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

const int N = 100000 + 10;
vector<int> adj[N];
int d[N];

int main()
{
//    freopen("in.txt", "r", stdin);
    int x, y;
    while (scanf("%d%d", &x, &y) != EOF && (x != -1 || y != -1))
    {
        //no point
        if (x == 0 && y == 0)
        {
            printf("Yes\n");
            continue;
        }

        memset(d, 0, sizeof(d));
        for (int i = 0; i < N; i++)
            adj[i].clear();
        d[x]++, d[y]++;
        adj[x].push_back(y);
        adj[y].push_back(x);
        while (scanf("%d%d", &x, &y) != EOF && (x + y))
        {
            d[x]++, d[y]++;
            adj[x].push_back(y);
            adj[y].push_back(x);
        }

        //判断是否无环and连通(利用无向图顶点的度)
        queue<int> q;
        for (int i = 1; i <= N; i++)
            if (d[i] == 1)
            {
                q.push(i);
                break;
            }
        while (!q.empty())
        {
            int tmp = q.front();
            d[tmp] = -1;
            q.pop();
            if (adj[tmp].size() == 1)
            {
                int temp = adj[tmp][0];
                for (int i = 0; i < adj[temp].size(); i++)
                {
                    if (adj[temp][i] == tmp)
                        adj[temp].erase(adj[temp].begin() + i);
                    if (d[adj[temp][i]] <= 1)
                        q.push(adj[temp][i]);
                }
                d[temp]--;
                if (d[temp] <= 1)
                    q.push(temp);
                adj[tmp].clear();
            }
        }
        int cnt = 0;
        for (int i = 1; i <= N; i++)
            if (d[i] > 0)
                cnt++;

        if (cnt == 0)
            printf("Yes\n");
        else printf("No\n");
    }
}


代码2:

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

const int N = 100000 + 10;
bool used[N];
vector<int> adj[N];

int main()
{
//    freopen("in.txt", "r", stdin);

    int x, y;
    while (scanf("%d%d", &x, &y) != EOF && (x != -1 || y != -1))
    {
        //no point
        if (x == 0 && y == 0)
        {
            printf("Yes\n");
            continue;
        }

        queue<int> q;
        q.push(x);

        int cnte = 0, cntp = 0;
        for (int i = 0; i < N; i++)
            adj[i].clear();
        memset (used, 0, sizeof(used));
        if (!used[x]) used[x] = 1, cntp++;
        if (!used[y]) used[y] = 1, cntp++;
        cnte++;
        adj[x].push_back(y);
        adj[y].push_back(x);
        while (scanf("%d%d", &x, &y) != EOF && (x != 0 || y != 0))
        {
            if (!used[x]) used[x] = 1, cntp++;
            if (!used[y]) used[y] = 1, cntp++;
            cnte++;
            adj[x].push_back(y);
            adj[y].push_back(x);
        }

        //if the graph is connected
        memset(used, 0, sizeof(used));
        used[q.front()] = true;
        int ans = 1;
        while (!q.empty())
        {
            int tmp = q.front();
            q.pop();
            for (int i = 0; i < adj[tmp].size(); i++)
                if (!used[adj[tmp][i]])
                {
                    q.push(adj[tmp][i]);
                    used[adj[tmp][i]] = true;
                    ans++;
                }
        }

        //如果无回路,则顶点数等于边数+1
        if (cnte == cntp - 1 && ans == cntp)
            printf("Yes\n");
        else printf("No\n");
    }
}


HDU1272 - 小希的迷宫 并查集检测无向图的环 HDU1272 - 小希的迷宫 利用并查集检测无向图的环 阅读详情

相关推荐

电拖笔记1电磁学基本知识与定律

电拖学习

qq458629839的博客 1136

判断图的连通性

判断图的连通性 判断图的连通性的方法有3种:并查集,DFS,BFS; 并查集 介绍: 并查集,在一些有N个元素的集合应用问题中,我们通常是在开始时让每个元素构成一个单元素的集合,然后按一定顺序将属于同一组的元素所在的集合合并,其间要反复查找一个元素在哪个集合中。这一类问题近几年来反复出现在信息学的国际国内赛题中,其特点是看似并不复杂,但数据量极大,若用正常的数据结构来描述的话,往往在空间上过...

@别样的博客 1万+

嵌入式开发避坑指南:用DWT做延时函数,这几个细节不注意代码会跑飞

本文深入探讨了在Cortex-M嵌入式开发中使用DWT实现精确延时函数的关键技巧与常见陷阱。针对DWT_CYCCNT计数器应用中的内核兼容性、溢出处理、编译器优化等五大核心问题,提供了工业级稳健解决方案,帮助开发者避免代码跑飞风险,实现微秒级高精度延时控制。

weixin_42653691的博客 162

HDU 1272小希的迷宫

HDU 1272小希的迷宫 005 Problem Description 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一...

GG_Bond的博客 154

R语言dlnm包避坑指南:手把手教你配置交叉基矩阵(附温度分层与滞后多项式设置)

本文详细介绍了R语言dlnm包在配置交叉基矩阵时的实用技巧与避坑指南,特别针对温度分层与滞后多项式设置提供了具体参数配置建议。通过解析`crossbasis()`函数的核心参数、温度分析的分层策略以及不同基函数的适用场景,帮助研究者高效构建分布滞后非线性模型,避免常见错误并优化模型性能。

weixin_34094282的博客 403

如何用YOLOv5改进无人机小目标检测?MFFSODNet实战教程(附代码)

本文详细介绍了如何利用YOLOv5框架结合MFFSODNet网络结构优化无人机航拍图像中的小目标检测。通过引入微小目标预测头、多尺度特征提取模块(MSFEM)和双向密集特征金字塔网络(BDFPN)等核心技术,显著提升了小目标检测精度。文章提供了完整的代码实现方案,并展示了在农业监测、电力巡检等实际场景中的应用效果。

sre5engineer的博客 741

HDU 1272 小希的迷宫(并查集)

HDU 1272 小希的迷宫 https://vjudge.net/problem/HDU-1272 思路: 1.不能有环 2.所有点之间都要连通 我们可以用并查集,没有环并且只有一个集合(祖先)。 Code: #include <iostream> #include <cstdio> using namespace std; const int maxn = 1e5 +...

NaNa 267

天地图下载带审图号(审图号: GS(2024)0650号)的 “行政区划” 数据(含shp文件下载地址)

在科研投稿论文过程中,多数期刊杂志要求我们制作涉及国界的图件,必须使用自然资源部地图技术审查中心发布的标准地图底图。如地理学报、地理科学等期刊的投稿指南中写到:非标准底图本刊不予发表!(如图1.1所示)如果一定要用,凡涉国界图件(国内部分地区、全国、世界部分地区、全球)必须使用自然资源部标准地图服务系统标准地图底图(http://bzdt.ch.mnr.gov.cn/)(如图1.1所示)或国家测绘局地理信息局标准地图底图(如图1.2所示),所用底图边界要完全无修改(包括南海诸岛位置)。

JData_Engineer的博客 2306

小希的迷宫 HDU - 1272

小希的迷宫HDU - 1272上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现在把她...

cjc7373的博客 265

GDB交叉编译与问题解决:从零到精通的深度指南

完成后,GDB会安装到/usr/local/gdb-aarch64/bin,可以用aarch64-linux-gnu-gdb --version检查。:得有支持目标架构的交叉编译工具链,比如gcc-arm-none-eabi(用于ARM裸机)或aarch64-linux-gnu-gcc(用于ARM Linux)。:在配置工具链时,运行aarch64-linux-gnu-gcc --version检查版本,确保工具链没问题。这种场景下用GDB调试,就像在荒野求生,但别慌,GDB依然是你的好伙伴。

大模型大数据攻城狮的专栏 1万+

手写中间件之——并行框架(1 并行框架的应用场景和需求)

我们为什么会需要一个带任务顺序编排的并行框架 1 复杂的微服务系统间调用 经常会有这样的调用场景:app(或web前端)调用后台的一个接口,该接口接到该请求后,需要调用其他多个微服务来获取数据,最终汇总一个最终结果返回给用户。 譬如用户请求“我的订单”,后台在收到请求后,就需要去调用用户详情rpc、商品详情rpc、库存rpc、优惠券rpc等等很多个服务。有些服务是可以并行去请求的,但有些服务...

tianyaleixiaowu的专栏 1万+

hdu 1272 小希的迷宫

暂未解决

h2017010687的博客 187

Apifox接口测试+自动化测试

Apifox 接口测试+自动化测试快速入门!

程序员小杨哥的博客 1万+

hdu 1272 小希的迷宫(并查集)

hdu 1272 小希的迷宫 http://acm.hdu.edu.cn/showproblem.php?pid=1272 ProblemDescription 上次Gardon的迷宫城堡小希玩了很久(见ProblemB),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和...

diansitao5461的博客 171

老版QQ原生表情gif动态

这是老版的QQ表情,不过全是动态的的,Windows照片查看器是不会动的,可以右击用浏览器打开查看,再说一遍是老版的,只是分享给宁愿用老版也要动态的人。

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

【HDU1272】小希的迷宫解题报告,数据+思路+代码

#include #include #include #include #define INPUT using namespace std; /* Problem : HDU1272 - 小希的迷宫 State : 5421320 2012-02-26 23:40:14 Accepted 1272 62MS 1636K 3853 B G++ c0de4fun

c0de4fun的完美算(nei)法(he)教室-我们仍不知道,那天调用的驱动的名字。 1820

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

【判断是不是树】HDU 1272 小希的迷宫

HDU 1272 #include <iostream> #include <algorithm> #include <cstdio> #include <cmath> #include <cstring> #include <string> #include <queue> #include <vector...

L_X_ 169

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

HDU-1272-小希的迷宫

HDU-1272-小希的迷宫 http://acm.hdu.edu.cn/showproblem.php?pid=1272 基本的并查集 #include #include using namespace std; #define N 100010 int f[N]; int mark[N]; int find(int x) { int r=x; while(f[r]!=r) r=f[

菜鸟的程序人生 963

HDU 1272 小希的迷宫

链接 - http://acm.hdu.edu.cn/showproblem.php?pid=1272 分析 迷宫可能为空,即该组数据仅有 0 0 代码 /* hdu 1272 小希的迷宫 */ #include<bits/stdc++.h> using namespace std; #define MXN 100010 int N, M, fa[MXN], flag; int find(int x){ if(x != fa[x]) fa[x] = find(fa[x]); retur

jpphy0的博客 149

HDU 1272 小希的迷宫 【并查集+判无向无环连通图】

HDU 1272 小希的迷宫 题目链接:vjudge传送门 具体思路: 做过Is It A Tree后就知道,这题比它简单点,只需要把判断入度的条件去掉,感兴趣的这里是题解 这题具体是用并查集维护 新加入一条边时,判断两点是否同一集合 是,则构成有环图,不满足 否,则将两点加入同一集合中 最后判断一下是否是空图(满足),或者非连通图(不满足),即可 具体代码: #include<iostre...

指弹键盘哼民谣 525

HDU - 1272 - 小希的迷宫

HDU - 1272 - 小希的迷宫 Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/32768 K (Java/Others) Problem Description上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所

在努力! 735

小希的迷宫——HDU1272

HDU-1272 kuangbin 上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希望任意两个房间有且仅有一条路径可以相通(除非走了回头路)。小希现...

weixin_44641254的博客 2298

hdu 1272 小希的迷宫(判断成环)

题目链接: hdu 1272 小希的迷宫 题意:若整个无向图连通,并且不成环,则输出Yes,否则输出No 判断成环: 若两个点的祖宗相同,并且这两个点相连,则说明成环 整个无向图连通,表明只有一个根节点 #include #include #include #define maxn 111111 using namespace std; int father[maxn]; int Fin

parting_soul的专栏 380

HDU1272 小希的迷宫 - 并查集

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1272输入需要注意下,其次用set<>集合处理较方便/* HDU1272 小希的迷宫 http://acm.hdu.edu.cn/showproblem.php?pid=1272 */ #include <iostream> #include <stdio.h> #include <algorit

master-dragon的专栏 683

【并查集】 HDU 1272 小希的迷宫

HDU 1272 小希的迷宫 http://acm.hdu.edu.cn/showproblem.php?pid=1272

Reluxer 512
上一篇: 暗时间
下一篇: 经验值++
xjwJava
博客等级 码龄16年 19粉丝 48原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值