8月19日CCPC——Vertex Cover(未解决)
来源:互联网 发布:c语言中switch 编辑:程序博客网 时间:2024/06/09 14:52
Problem DescriptionAs we know, minimumvertexcover is a classical NP-complete problem. There will not be polynomial time algorithm for it unless P=NP.You can see the definition of vertex cover in https://en.wikipedia.org/wiki/Vertex_cover.Today, little M designs an "approximate" algorithm for vertex cover. It is a greedy algorithm. The main idea of her algorithm is that always choosing the maximum degree vertex into the solution set. The pseudo code of her algorithm is as follows:We assume that the labels of the vertices are from 1 to n.for (int i = 1; i <= n; ++i) { use[i] = false; deg[i] = degree of the vertex i;}int ans = 0;while (true) { int mx = -1, u; for (int i = 1; i <= n; ++i) { if (use[i]) continue; if (deg[i] >= mx) { mx = deg[i]; u = i; } } if (mx <= 0) break; ++ans; use[u] = true; for (each vertex v adjacent to u) --deg[v];}return ans;As a theory computer scientist, you immediately find that it is a bad algorithm. To show her that this algorithm dose not have a constant approximate factor, you need to construct an instance of vertex cover such that the solution get by this algorithm is much worse than the optimal solution.Formally, your program need to output a simple undirected graph of at most 500 vertices. Moreover, you need to output a vertex cover solution of your graph. Your program will get Accept if and only if the solution size get by the above algorithm is at least three times as much as yours. InputThere is no input. OutputFirst, output two integer n and m in a line, separated by a space, means the number of the vertices and the number of the edges in your graph.In the next m lines, you should output two integers u and v for each line, separated by a space, which denotes an edge of your graph. It must be satisfied that 1≤u,v≤n and your graph is a simple undirected graph.In the next line, output an integer k(1≤k≤n), means the size of your vertex cover solution.Then output k lines, each line contains an integer u(1≤u≤n) which denotes the label of a vertex in your solution. It must be satisfied that your solution is a vertex cover of your graph. Sample Output4 41 22 33 44 1213HintThe sample output is just to exemplify the output format.
答案未更新......
阅读全文
0 0
- 8月19日CCPC——Vertex Cover(未解决)
- 8月19日CCPC——Party(未解决)
- 8月19日CCPC——A Secret(未解决)
- 8月19号CCPC——Palindrome Function(未解决)
- 8月19号CCPC——The Karting(未解决)
- 8月19日CCPC——Friend-Graph
- 8月19号CCPC——CaoHaha's staff(未解答)
- 8月19号CCPC——The Designer(未解答)
- 8月19号CCPC——Graph Of Zhuper(未解答)
- HDU6150&&2017CCPC网络赛Vertex Cover
- 2017 ccpc网络赛 1001 Vertex Cover(二分图 构造)HDU6150
- HDU6150-Vertex Cover(构造)
- Vertex Cover
- Vertex Cover
- Vertex Cover
- HDU 6150 Vertex Cover (思路 构造)
- HDU-6150 Vertex Cover(构造)
- HDU 6150 Vertex Cover (构造)
- Idea的插件管理——持续更新
- TcpServe
- 技术与技术人员的价值
- Day03 Web表单
- ACM 暑假有感
- 8月19日CCPC——Vertex Cover(未解决)
- 201612-3 权限查询
- kafka异步发送数据,不阻塞
- bitmap和图片文件的转换
- Android-universal-imageloader
- codility PermMissingElem
- Linux命令
- BNF学习笔记
- 3.1C++学习之-socket(TCP)