当前位置:网站首页>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()不断循环把点分到两个集合。
代码:
边栏推荐
- 大佬们有遇到过这个问题吗? MySQL 2.2 和 2.3-SNAPSHOT 都这样,貌似是
- AICOCO AI Frontier Promotion (8.10)
- Nanodlp v2.2/v3.0光固化电路板,机械开关/光电开关/接近开关的接法和系统状态电平设置
- H264 码率控制
- 【论文+代码】PEBAL/Pixel-wise Energy-biased Abstention Learning for Anomaly Segmentation on Complex Urban Driving Scenes(复杂城市驾驶场景异常分割的像素级能量偏置弃权学习)
- 数字藏品,“赌”字当头
- 【黑马早报】雷军称低谷期曾想转行开酒吧;拜登正式签署芯片法案;软银二季度巨亏230亿美元;北京市消协约谈每日优鲜...
- 想问下大佬们 ,cdc oracle初始化一张300万的表任务运行着后面就这个错 怎么解决哇
- 漏洞管理计划的未来趋势
- Alibaba Cloud Jia Zhaohui: Cloud XR platform supports Bizhen Technology to present a virtual concert of national style sci-fi
猜你喜欢
Keithley DMM7510 accurate measurement of ultra-low power consumption equipment all kinds of operation mode power consumption
Reversing words in a string in LeetCode
爱可可AI前沿推介(8.10)
十八、一起学习Lua 调试(Debug)
Nanodlp v2.2/v3.0 light curing circuit board, connection method of mechanical switch/photoelectric switch/proximity switch and system state level setting
Solve the idea that unit tests cannot use Scanner
LeetCode·297.二叉树的序列化与反序列化·DFS·BFS
把相亲角搬到海外,不愧是咱爸妈
【黑马早报】雷军称低谷期曾想转行开酒吧;拜登正式签署芯片法案;软银二季度巨亏230亿美元;北京市消协约谈每日优鲜...
Proprietary cloud ABC Stack, the real strength!
随机推荐
Solve the idea that unit tests cannot use Scanner
48 the mysql database
协程与任务
国外媒体宣发怎样做才可以把握重点
2022 Recruitment Notice for Academician Zhao Guoping Group of Shenzhen Institute of Advanced Technology, Chinese Academy of Sciences
IP地址分类以及网络地址的计算(子网划分、超网划分)[通俗易懂]
Code Casual Recording Notes_Dynamic Programming_70 Climbing Stairs
LeetCode·297.二叉树的序列化与反序列化·DFS·BFS
M²BEV: Multi-Camera Joint 3D Detection and Segmentation with Unified Bird’s-Eye View Representation
在web页面播放rtsp流视频(webrtc)
鸿蒙开发从hello world开始
【mysql索引实现原理】
海外邮件发送指南(二)
娄底植物细胞实验室建设基本组成要点
数字藏品,“赌”字当头
Efficient and Robust 2D-to-BEV Representation Learning via Geometry-guided Kernel Transformer 论文笔记
AtCoder初学者比赛077 D -小多
Inventory of Loudi Agricultural Products Inspection Laboratory Construction Guidelines
shell:正则表达式及三剑客grep命令
多线程下自旋锁设计基本思想