[poj2349 Arctic Network]最小生成树

Unity抖音小游戏上架实战:从零到一,详解流程与避坑指南 本文详细介绍了Unity抖音小游戏上架的全流程,包括环境准备、SDK集成、开发者账号注册、软著申请、打包提交流程及常见问题解决方案。重点解析了抖音小游戏平台特有的配置细节和避坑技巧,帮助开发者高效完成游戏上架并优化用户体验。 阅读详情
Arctic Network
Time Limit: 2000MS Memory Limit: 65536K
Total Submissions: 10805 Accepted: 3542

Description

The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the network: every outpost will have a radio transceiver and some outposts will in addition have a satellite channel.
Any two outposts with a satellite channel can communicate via the satellite, regardless of their location. Otherwise, two outposts can communicate by radio only if the distance between them does not exceed D, which depends of the power of the transceivers. Higher power yields higher D but costs more. Due to purchasing and maintenance considerations, the transceivers at the outposts must be identical; that is, the value of D is the same for every pair of outposts.

Your job is to determine the minimum D required for the transceivers. There must be at least one communication path (direct or indirect) between every pair of outposts.

Input

The first line of input contains N, the number of test cases. The first line of each test case contains 1 <= S <= 100, the number of satellite channels, and S < P <= 500, the number of outposts. P lines follow, giving the (x,y) coordinates of each outpost in km (coordinates are integers between 0 and 10,000).

Output

For each case, output should consist of a single line giving the minimum D required to connect the network. Output should be specified to 2 decimal points.

Sample Input

1
2 4
0 100
0 300
0 600
150 750

Sample Output

212.13

Source

Waterloo local 2002.09.28
Kruskal搞的最小生成树。
Memory: 2676K Time: 110MS
Language: G++ Result: Accepted
/*
	初始化每个点一个连通分量 
	每次只需要选最小边即可,然后在剩下s个连通分量时答案就更新完毕鸟
*/ 
#include <cstdio>
#include <cmath>
#include <cstring>
#include <vector>
#include <queue>
using namespace std;

const double INF = 1e10;
const int MAX = 512;
struct Point {
	double x, y;
	double dis(const Point& B) {
		return sqrt((x - B.x) * (x - B.x) + (y - B.y ) * (y - B.y));
	}
} a[MAX];
struct edge {
	int from, to;
	double cost;
};
struct cmp {
	bool operator()(edge& e1, edge& e2) {
		return e1.cost > e2.cost;
	}
};

int father[MAX];

int find(int x) {
	return x == father[x] ? x : father[x] = find(father[x]);
}
void Union(int x, int y) {
	int fx = find(x), fy = find(y);
	if (fx != fy) {
		father[fx] = fy;
	}
}

double gao(int s, int p) {
	priority_queue<edge, vector<edge>, cmp> Q;
	for (int i = 0; i < p; ++i) {
		for (int j = i + 1; j < p; ++j) {
			Q.push((struct edge){i, j, a[i].dis(a[j])});
		}
		father[i] = i;
	}
	double ans = 0.0;
	for (int i = s; i < p; ++i) {
		edge e;
		e.from = e.to = e.cost = 0.0;
		while (!Q.empty()) {
			e = Q.top();
			Q.pop();
			if (find(e.from) != find(e.to)) break;
		}
		
		Union(e.from, e.to);
		if (ans < e.cost) ans = e.cost;
	}
	return ans;
}

int main() {
	int T;
	scanf(" %d", &T);
	while (T--) {
		int s, p;
		scanf(" %d %d", &s, &p);
		for (int i = 0; i < p; ++i) {
			scanf(" %lf %lf", &a[i].x, &a[i].y);
		}
		printf("%.2f\n", gao(s, p));
	}
	return 0;
}


自抗扰控制ADRC原理解析及案例应用 ESO的设计通常基于系统动态方程的线性化或近似模型,其输出包括系统状态的估计值和总扰动的估计值。非线性状态误差反馈控制律(Nonlinear State Error Feedback,NLSEF)是ADRC的最后一个环节,负责根据ESO和TD提供的信息生成控制信号。ADRC的另一个重要发展方向是与其他控制策略的融合,如模糊控制、神经网络和自适应控制等,以进一步提高系统的鲁棒性和适应性。ADRC的参数主要包括扩张状态观测器(ESO)的参数和非线性状态误差反馈控制律(NLSEF)的参数。 阅读详情

相关推荐

CATIA P3 V5-6R2023在Windows 11 23H2上的稳定安装与系统级配置指南

CATIA是高端制造业核心的三维参数化设计平台,其运行依赖严格的系统底层支撑。理解CATIA的BRep几何内核原理与Windows子系统(如WSL、Hyper-V)的协同机制,是保障建模稳定性与计算精度的技术前提。CATIA Run-Time Library和OpenGL硬件加速能力共同决定了曲面重建、螺纹建模等关键操作的可靠性;而.NET Framework 3.5、VC++ 2022运行库及显卡Studio驱动的精准匹配,则构成工业软件在Win11环境落地的工程基础。本文聚焦于航空、轨交、能源等领域高频

weixin_30983353的博客 703

最短路问题-最小生成树-通信问题

The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the network: every outpost will have a radio transceiver and some outposts w

weixin_46204099的博客 422

Apache Flink集成HDFS报错Failed to create checkpoint storage at checkpoint coordinator side.

在网上查询相关资料后,在flink的lib目录添加flink-shaded-hadoop-3-3.1.1.7.0.3.0-79-7.0.jar、commons-cli-1.5.0.jar两个包,但报错依旧存在,添加了export HADOOP_CLASSPATH=后面发现是hadoop与flink的兼容性问题,hadoop原先使用的是3.3.4,与多个版本的flink集成都会出现报错,最后将Hadoop的版本改成3.1.3,使用flink run运行jar包就没有这个错误了,在hdfs上成功保存了检查点。

zywenmag的博客 630

【POJ 2349 --- Arctic Network】prim || kruskal

【POJ 2349 --- Arctic Network】prim || kruskal 题目来源:点击进入【POJ 2349 — Arctic Network】 Description The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network...

来日浅谈的博客 545

3.5.3以太网ETH TC8-PMA物理层测试

英文原版-OA_Automotive_Ethernet_ECU_TestSpecification_Layer_1_100BASE-T1_v3.0.pdf。PMA测试时各个测试项目所进入的测试模式不同,如TX_01对应测试模式1;TX_04对应测试模式5;例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使我们快速便捷地处理数据的函数和方法。TX_07对应测试模式5;物理层测试主要分为两部分:IOP测试(包括链接时间,信号质量,线路诊断),PMA测试。

qq_28664971的博客 7733

drm 之modes

#define _GNU_SOURCE #include <errno.h> #include <fcntl.h> #include <stdbool.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/mman.h> #include <time.h&...

u012794472的专栏 3738

POJ 2349 Arctic Network

2016.12.30【题目简述】 The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the

Forever_MZY 364

探索Vortex开源GPGPU:RISC-V SIMT架构(4-1),Execute SFU(1)

本文详细分析了Vortex RISC-V内核6级流水线中Execute阶段的SFU(特殊功能单元)模块。重点介绍了SFU的数据流结构,包含dispatch_unit、pe_switch、csr_unit、wctl_unit和gather_unit五个子模块。文章深入解析了warp控制指令wspawn和tmc的实现机制:wspawn用于激活指定数量的warp并设置新PC值,tmc则用于控制线程掩码和warp状态。通过C代码和汇编指令的对照分析,阐明了这些指令在并行计算中的关键作用,包括线程激活、状态切换和执行

weixin_55313207的博客 1376

POJ 2349 Arctic Network——最小生成树

问题来源Arctic Network。 Description The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in...

anlian523的博客 389

基于STM32L4XX 、HAL库的TMP144YFFR数字温度传感器驱动应用C语言程序设计

define TMP144_ADDRESS 0x00 // 默认为全局地址,用于单器件或MDA命令。#define TMP144_CMD_READ_TEMP 0x00 // 读取温度寄存器命令。if (temp_raw & 0x800) { // 判断第11位(符号位)

PP_Cottage的博客 96

YOLO26魔改:ICIP2026 SDTA|单深度转置注意力注入C2PSA,长程依赖与局部细节双增强,mAP提升显著

多尺度适配:SDTA的深度卷积与C2PSA的空间注意力结合,增强对多尺度目标的结构感知,改善遮挡与密集场景下的检测鲁棒性。

①订阅者答疑群聊服务;②FDE:工业缺陷检测项目;③paper/创新算法指导;④免费提供YOLO创新涨点推荐顾问Skill和AI小怪兽数字分身; 313

POJ-2349题解

POJ-2349 题目描述The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies ar...

cpongo11的博客 518

Python爬虫实战:逆向工程与异步处理攻克Pinterest无限滚动瀑布流

我们将从零开始,逐步分析其数据接口,构建一个功能完整的爬虫,并深入探讨反爬虫策略的应对、性能优化以及数据存储等高级主题。: 在实际爬取中,你需要先访问一次Pinterest主页,获取初始的Cookie和CSRF Token,然后再发起API请求。: Python爬虫,Pinterest,无限滚动,瀑布流,异步IO,httpx,逆向工程,API接口,动态内容,反爬虫。你会很快发现一些关键的请求模式。:页面初始加载有限内容,随着用户滚动,新的图片块通过AJAX动态加载,实现“永无止境”的浏览。

2201_76125261的博客 554

poj2349 Arctic Network 最小生成树

poj2349 表示刚开始读题就读了n久没有读明白。。。明白了题意以后这题真真是个套模板的题 题意:哨站有两种通信方式:通过卫星和通过建立无线网络,通过卫星可以任意通信, 通过无线网络那么距离不能超过D,求这个最小距离D。 思路:s代表了可以扔掉s-1条边,p表示点 我采用了kruskal算法,在建立好的最小生成树中去掉s-1条边,那么返回上一个的权值w即可。 #include #in

竹丙丙丙丙 404

vb 6.0并口开发操作实例

vb6并口开发,简体中文,试例内有inpout32.dll动态链接库

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

(最小生成树)POJ2349Arctic Network

POJ2349Arctic Network 题意&思路: 给你p个点和s-1条免费边,问使两两点连通的最小的最长边。 求第p-s条最长边,kruskal。用%lf记得交c++。 代码: #include<iostream> #include<stdio.h> #include<stdlib.h> #include<algorithm> #in...

Z7784562的博客 294

Outlook Express 6 (OE6) for Win7/Win8/Win10

英文版 Outlook Express6.0, 兼容Win7/Win10/WinXP,解压就可用。

POJ 2349 Arctic Network (最小生成树)

POJ 2349 Arctic Network (最小生成树)

一枚空指针的博客 383

老版QQ原生表情gif动态

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

Arctic Network/POJ 2349/最小生成树

Arctic Network/POJ 2349/最小生成树 题目 The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in ...

weixin_45600829的博客 146

POJ2349 Arctic Network 最小生成树

链接: 2349 题意:一个平面网络中 有M个卫星N个站点,每两个站点之间可以用通讯器联系或用卫星联系,用通讯器联系的花销和距离有关,用卫星联系则不需要花销。给出每个站点的坐标(x,y),求这个网络最小生成树的最大边。 题解: M个卫星一共可以减去M-1条边,通过prim算法求出生成树中的所有(n-1)条边,通过排序,再减去(m-1)

旧时光 1008

POJ 2349 Arctic Network 最小生成树

POJ 2349 Arctic Network 最小生成树 Kruskal

LucienShui 646

POJ 2349 Arctic Network 最小生成树题解

本题也是使用Prime和Kruskal都可以的最小生成树的题解。 本题一点新意就是:需要除去最大的S-1个距离,因为可以使用卫星覆盖这些距离。 技巧:建图建有向图,速度快点,不用计算两边。 这里使用Prime,因为是稠密图。 #include #include #include #include #include #include using std::sort; c

靖空间 1382

POJ 2349 Arctic Network(进阶指南,最小生成树)

算法竞赛进阶指南,454页,最小生成树,kruskal 题目意思: 有n个 北部前哨站, 每个站都可以用无线电收发器来通信,也可以用卫星电话通信; 卫星电话不受距离影响,但数量少,只有s个。无线电收发器每一个前哨站都有,受距离影响, 距离D越远,成本越高。无线电通信距离D都是相同的。 题目要求,使得n个前哨站能直接或间接通信, 成本最少,也就是无线电收发器的通信距离D最短。 本题要点: 1、 有 s个卫星,那么最小生成树就可以少 s - 1 条边。 原来树有 n点,n - 1 条边, 减去 s - 1 条,

qq_38232157的博客 177

POJ 2349 Arctic Network 最小生成树 prim && kruscal

Arctic Network 克鲁斯卡尔(kruscal)或普里姆算法(Prim) 求最小生成树。 Arctic Network Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 13208 Accepted: 4284 Description The Department of National Defence (DND) wishes to connect several northern outposts by a w

jianjun的专栏 638

POJ 2349-Arctic Network【最小生成树】

题目描述 The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the network: e...

include_peng的博客 331

POJ 2349 Arctic Network(最小生成树思想)

POJ 2349 Arctic Network(最小生成树思想) http://poj.org/problem?id=2349 题意: 题意有点坑…        有P个站点需要远程通信,它们能通过两种方式来通信:无线电和卫星. 如果两个站点通过两个卫星接收器(坑,每个站点各一个卫星接收器)来通信的话,它们直接无论多远都行且不花钱. 如果两个站点通过无线电来通信的话,需要花钱且距离越长花费越

code 1288

POJ - 2349 Arctic Network 最小生成树

GDUT 2020寒假训练 图论 E 原题链接 POJ - 2349 Arctic Network E - Arctic Network 题目 Description The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two ...

xcy2001的博客 345

POJ 2349 Arctic Network 【最小生成树变形】

Description The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the n

Kelisiya 395
上一篇: [poj1144 Network]tarjan求割点
下一篇: [poj1258 Agri-Net]最小生成树
bit_line
博客等级 码龄12年 33粉丝 150原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值
⌂ 换网址