Network Saboteur
Time limit1sMemory limit128 MB
Split N nodes (N <= 20) into two sets A and B so the total weight of edges crossing between them is maximized.
- Level
Medium5 of 10
- Topics
- Brute force, Backtracking, Implementation
- Solved
- No attempts yet
Problem
A university network consists of computers. The system administrators measured the traffic between every pair of nodes and split the network into two subnetworks so that the traffic flowing between the two parts is as small as possible.
A disgruntled student, Vasya, who was expelled from the university, wants to do the opposite. He has taken control of the network and wants to reassign the computers so that the traffic between the two subnetworks is as large as possible. Computing this worst-case split is a problem he cannot solve, so he asks you for help.
The traffic is given as a matrix , where is the amount of data exchanged between node and node . The matrix is symmetric () and has no self-traffic (). Partition the nodes into two disjoint sets and so as to maximize
Input
The first line contains the number of nodes ().
Each of the following lines contains space-separated integers; the -th integer on the -th line is (). The matrix is symmetric with a zero diagonal.
Output
Print a single integer — the maximum possible traffic between the two subnetworks.