Submit | All submissions | Best solutions | Back to list |
Problem hidden on 2014-12-25 23:01:11 by (Tjandra Satria Gunawan)(曾毅昆)
VERCOVER - Fewest possible vertices to cover a graph |
Let G be a graph with a set of n nodes and a set of m edges. A vertex cover VC is a subset of the nodes, such that each edge in graph G is covered by at least one node in the subset. (One or both ends of each edge must be in VC).
A minimal vertex cover is a vertex cover for G such that removing one of the nodes in the set causes at least one edge in G to be uncovered.
In this task, you are given a undirected graph as the input, and you have to find as small as possible vertex cover within the time limit. Your score is the average of ratios of the total number of nodes in vertex covers to the total nodes in the graph for all of the test cases.
Input
The first line contains two integers, n and m, representing the numbers of nodes and edges in the graph. 3 ≤ n ≤ 2000 and 3 ≤ m ≤ 40000. The nodes are numbered 1..n. The next m lines contain pair of integers representing edges between two nodes. The list of edges is not in any particular order.
Output
There should be only one line of output, listing all valid nodes in the vertex cover you found in the graph. The nodes are separated by one space.
Example
Input:6 7
1 2
1 5
2 3
2 5
3 4
3 6
5 6
Output:
5 3 2
Added by: | Jimmy Tirtawangsa |
Date: | 2012-12-27 |
Time limit: | 0.200s-3s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | http://en.wikipedia.org/wiki/Vertex_cover |
hide comments
2013-02-01 22:11:59 (Tjandra Satria Gunawan)(曾毅昆)
glad that I'm not solve this problem (wasted time) :-P |
|
2013-02-01 21:24:04 Robert Gerbicz
OK, hidden the problem, the 2 reasons: 1. broken scoring 2. small graphs |
|
2013-02-01 14:55:22 Mitch Schwartz
Scoring for this problem is broken -- because of the way points are calculated, top score of 0 means nobody gets any points for it. Last edit: 2013-02-01 15:01:42 |
|
2013-01-23 16:43:57 Francky
For question 2: There's several input files, and for each one a time limit from 1s to 15s (for the hardest one). |
|
2013-01-23 16:24:37 Pinco Pallino
I have two simple question: 1) @Robert Gerbicz How is possible to know the value of n ? 2) What does it means Time Limit: 1s-15s is 1 sec or 15 secs ? thanks |
|
2013-01-19 14:42:27 Robert Gerbicz
Currently n<=50 for all input graphs, that is very small. Please add more graphs with larger n! |
|
2013-01-19 14:42:22 Adel Ali
Isn't vertex cover problem NP-Complete except for Bipartite graphs where it can be reduced to maximal matching?! I don't understand what the problem is really asking for?! A randomized algorithm maybe? ans (Gerbicz): No, the task isn't ask for the optimal minimal vertex cover (so the covering with the fewest number of points), any minimal vertex covering set should be good. Last edit: 2013-01-19 14:46:23 |
|
2013-01-19 14:24:33 Robert Gerbicz
Not written, but you should print a minimal(!) vertex cover, so for only a (valid) vertex cover you will get WA. Last edit: 2013-01-19 14:28:01 |
|
2013-01-18 17:51:14 Aditya Pande
Last edit: 2013-01-27 16:56:24 |