当前位置:网站首页>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()不断循环把点分到两个集合。
代码:
边栏推荐
猜你喜欢

没有接班人,格力只剩“明珠精选”

jenkins数据迁移和备份

数字藏品,“赌”字当头

实践为主,理论为辅!腾讯大佬MySQL高阶宝典震撼来袭!

Chapter9 : De Novo Molecular Design with Chemical Language Models

生成树协议STP(Spanning Tree Protocol)

十八、一起学习Lua 调试(Debug)

Chapter9 : De Novo Molecular Design with Chemical Language Models

【论文+代码】PEBAL/Pixel-wise Energy-biased Abstention Learning for Anomaly Segmentation on Complex Urban Driving Scenes(复杂城市驾驶场景异常分割的像素级能量偏置弃权学习)

Merge similar items in LeetCode simple questions
随机推荐
M²BEV: Multi-Camera Joint 3D Detection and Segmentation with Unified Bird’s-Eye View Representation
神了!阿里数据库专家纯手写了这份604页的Oracle+MySQL攻坚指南
iTextSharp操作PDF
Have you guys encountered this problem?MySQL 2.2 and 2.3-SNAPSHOT are like this, it seems to be
表中存在多个索引问题? - 聚集索引,回表,覆盖索引
百度用户产品流批一体的实时数仓实践
ASP.NET Core依赖注入系统学习教程:ServiceDescriptor(服务注册描述类型)
部署项目半途而废后续
Wirshark common operations and tcp three-way handshake process example analysis
浙大、阿里提出DictBERT,字典描述知识增强的预训练语言模型
H264 码率控制
MySQL相关问题整理
Overseas media publicity. What problems should domestic media pay attention to?
多线程下自旋锁设计基本思想
Solve the idea that unit tests cannot use Scanner
Codeforces Round #276 (Div. 1) B. Maximum Value
【jstack、jps命令使用】排查死锁
Twikoo腾讯云函数部署转移到私有部署
十八、一起学习Lua 调试(Debug)
47Haproxy集群