当前位置:网站首页>Network Saboteur
Network Saboteur
2022-08-10 12:24:00 【51CTO】
Problem Description
A university network is composed of N computers. System administrators gathered information on the traffic between nodes, and carefully divided the network into two subnetworks in order to minimize traffic between parts.
A disgruntled computer science student Vasya, after being expelled from the university, decided to have his revenge. He hacked into the university network and decided to reassign computers to maximize the traffic between two subnetworks.
Unfortunately, he found that calculating such worst subdivision is one of those problems he, being a student, failed to solve. So he asks you, a more successful CS student, to help him.
The traffic data are given in the form of matrix C, where Cij is the amount of data sent between ith and jth nodes (Cij = Cji, Cii = 0). The goal is to divide the network nodes into the two disjointed subsets A and B so as to maximize the sum ∑Cij (i∈A,j∈B).
Input
The first line of input contains a number of nodes N (2 <= N <= 20). The following N lines, containing N space-separated integers each, represent the traffic matrix C (0 <= Cij <= 10000). <br>Output file must contain a single integer -- the maximum traffic between the subnetworks. <br>
Output
Output must contain a single integer -- the maximum traffic between the subnetworks.
Sample Input
Sample Output
很多点直接有距离,把这些点分成两和集合,就两个集合最大的分法。
思路:
用dfs()不断循环把点分到两个集合。
代码:
边栏推荐
- 2022年8月中国数据库排行榜:openGauss重夺榜眼,PolarDB反超人大金仓
- 娄底妆品实验室建设规划构思
- sprintboot项目通过interceptor和filter实现接入授权控制
- Reversing words in a string in LeetCode
- 动态规划之最长回文子串
- Keithley DMM7510 accurate measurement of ultra-low power consumption equipment all kinds of operation mode power consumption
- 「企业架构」应用架构概述
- bgp双平面实验 路由策略控制流量
- ArcMAP出现-15的问题无法访问[Provide your license server administrator with the following information:Err-15]
- shell:正则表达式及三剑客grep命令
猜你喜欢
Jenkins修改端口号, jenkins容器修改默认端口号
StarRocks on AWS Review | Data Everywhere Series Event Shenzhen Station ended successfully
LeetCode简单题之合并相似的物品
BEVDet4D: Exploit Temporal Cues in Multi-camera 3D Object Detection 论文笔记
Polygon zkEVM工具——PIL和CIRCOM
实践为主,理论为辅!腾讯大佬MySQL高阶宝典震撼来袭!
Crypto Gaming: The Future of Gaming
mSystems | Zhongnong Wang Jie Group Reveals the Mechanisms Affecting Soil "Plastic Interstitial" Microbial Communities
数字藏品,“赌”字当头
ASP.NET Core依赖注入系统学习教程:ServiceDescriptor(服务注册描述类型)
随机推荐
BEVDet4D: Exploit Temporal Cues in Multi-camera 3D Object Detection 论文笔记
shell:正则表达式及三剑客grep命令
关于flask中static_folder 和 static_url_path参数理解
机器学习实战(2)——端到端的机器学习项目
数字藏品,“赌”字当头
Proprietary cloud ABC Stack, the real strength!
kubernetes介绍
娄底干细胞制备实验室建设须知要求
Inventory of Loudi Agricultural Products Inspection Laboratory Construction Guidelines
DNS欺骗-教程详解
StarRocks on AWS 回顾 | Data Everywhere 系列活动深圳站圆满结束
一文详解 implementation api embed
生成树协议STP(Spanning Tree Protocol)
燃炸!字节跳动成功上岸,只因刷爆LeetCode算法面试题
camshift achieves target tracking
鸿蒙开发从hello world开始
虚拟机桥接模式不能上网
Custom filters and interceptors implement ThreadLocal thread closure
Shell:数组
Code Casual Recording Notes_Dynamic Programming_70 Climbing Stairs