Vertex Cover

来源:互联网 发布:vmware虚拟机备份软件 编辑:程序博客网 时间:2024/06/05 10:03

Vertex Cover

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 256000/256000 K (Java/Others)
Total Submission(s): 0    Accepted Submission(s): 0
Special Judge


Problem Description
As we know, minimumvertexcover is a classical NP-complete problem. There will not be polynomial time algorithm for it unlessP=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.
 

Input
There is no input.
 

Output
First, 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 that1u,vn and your graph is a simple undirected graph.
In the next line, output an integer k(1kn), means the size of your vertex cover solution.
Then output k lines, each line contains an integer u(1un) 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 Output
4 41 22 33 44 1213
Hint
The sample output is just to exemplify the output format.
原创粉丝点击
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 淘宝退款了又收到货怎么办 商家收货后拒绝退款怎么办 申请退货退款卖家不处理怎么办 淘宝买东西换货卖家不发货怎么办 淘宝自动默认付款没发货怎么办 支付宝支付失败可钱扣了怎么办 苹果nfc感应坏了怎么办 老鼠添过的盘子怎么办 ie浏览器页面显示网页错误怎么办 Ⅵvo手机声音小怎么办 小米手机预约错了怎么办 小米note二手没解锁怎么办 艾灸后脸色越黑怎么办 淘宝软件类目不能上架宝贝怎么办 ae中没有mpg格式怎么办 淘宝小二处理不公怎么办 遇到卖保险的人怎么办 租房合同没理家电清单怎么办 普雪油烟机坏了怎么办 我累了 真的累了怎么办 u盘15g变成4g了怎么办 属兔的买了东户怎么办 玩时时彩输了2万怎么办 胸变的又软又小怎么办 u盘16g变成4g了怎么办 1岁宝宝吃了就吐怎么办 脚崴了肿了很痛怎么办 九格拼图5在9那怎么办 4s锁屏密码忘了怎么办 6p触屏偶尔乱跳怎么办 新办劳务公司的劳务资质怎么办 汽车没电了打不着火怎么办 吃凉的甜的牙疼怎么办 学车对点对不上怎么办 发现老公有外遇最明智的怎么办 想开个童装店但是没经验怎么办 母乳不够吃宝宝又不喝奶粉怎么办 掉头发很厉害怎么办有什么偏方 红米2a刷死机了怎么办 公司退市我们买的股票怎么办 黑魂3把npc杀了怎么办