#P10757. [WC2011] 关系挖掘
[WC2011] 关系挖掘
Problem Description
Some people say, “Any two people in the world can be connected through at most people.” Little B is very interested in this, so he started some research on relationship mining in social networks.
Now Little B has obtained social network testdata containing people, with pieces of relationship information. A relationship can be represented as , meaning that there is a relationship between people and , and the closeness is (). Little B now wants to choose people () as research targets. To make the research more reliable, he hopes that the total closeness of relationships among these people is as large as possible.
This problem can be abstracted as: given a weighted undirected graph and an integer , the goal is to find a subset of the vertex set such that and the following expression is maximized:
$$\sum_{(a_i,b_i,w_i)\in E \wedge a_i\in S \wedge b_i \in S} w_i$$Input Format
This is an output-only problem. There are input files relation*.in in your directory.
The first line of each input file contains three integers , , and , representing the number of vertices (people), the number of edges (relationships), and the number of vertices (people) to select, , in the given social network.
The next lines each contain three positive integers , , , describing an edge (relationship). All vertices (people) are numbered from to .
Output Format
For each input file, provide the corresponding output file relation*.out in the directory.
The output file should contain lines, each with one integer, indicating the index of one of the selected people.
3 2 2
1 2 3
1 3 5
1
3
Hint
Scoring.
For each test point, if you do not output anything or your output is invalid, you get points.
For each test point, there are four scoring parameters , , , and . Suppose the sum of closeness values among the people selected by the contestant is .
- If , you get points.
- If , you get points.
- If , you get points.
- If , you get points.
- If , you get points.
- If , you get point.
- Otherwise, you get points.
Translated by ChatGPT 5