http://codeforces.com/contest/330/problem/B
这道题可以围着一个可以与任何一个城市建路的城市建设。

 #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std; bool g[][];
int in[];
int main()
{
int n,m,a,b;
scanf("%d%d",&n,&m);
memset(in,,sizeof(in));
for(int i=; i<m; i++)
{
scanf("%d%d",&a,&b);
g[a][b]=g[b][a]=;
in[a]++;
in[b]++;
}
int c=;
printf("%d\n",n-);
for(int i=; i<=n; i++)
{
if(in[c]>in[i]) c=i;
}
for(int i=; i<=n; i++)
{
if(c!=i&&g[c][i]==)
{
printf("%d %d\n",c,i);
}
}
return ;
}

cf B. Road Construction的更多相关文章

  1. POJ3352 Road Construction(边双连通分量)

                                                                                                         ...

  2. POJ3352 Road Construction (双连通分量)

    Road Construction Time Limit:2000MS    Memory Limit:65536KB    64bit IO Format:%I64d & %I64u Sub ...

  3. poj 3352 Road Construction【边双连通求最少加多少条边使图双连通&&缩点】

    Road Construction Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 10141   Accepted: 503 ...

  4. POJ 3177 Redundant Paths POJ 3352 Road Construction(双连接)

    POJ 3177 Redundant Paths POJ 3352 Road Construction 题目链接 题意:两题一样的.一份代码能交.给定一个连通无向图,问加几条边能使得图变成一个双连通图 ...

  5. POJ3352 Road Construction 双连通分量+缩点

    Road Construction Description It's almost summer time, and that means that it's almost summer constr ...

  6. 【Tarjan缩点】PO3352 Road Construction

    Road Construction Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 12532   Accepted: 630 ...

  7. POJ P3352 Road Construction 解题报告

    P3352 Road Construction 描述 这几乎是夏季,这意味着它几乎是夏季施工时间!今年,负责岛屿热带岛屿天堂道路的优秀人士,希望修复和升级岛上各个旅游景点之间的各种道路. 道路本身也很 ...

  8. [POJ3352]Road Construction

    [POJ3352]Road Construction 试题描述 It's almost summer time, and that means that it's almost summer cons ...

  9. POJ-3352 Road Construction,tarjan缩点求边双连通!

    Road Construction 本来不想做这个题,下午总结的时候发现自己花了一周的时间学连通图却连什么是边双连通不清楚,于是百度了一下相关内容,原来就是一个点到另一个至少有两条不同的路. 题意:给 ...

随机推荐

  1. Smarty for foreach 使用

    {for} {for}{forelse}用于创建一个简单的循环. 下面的几种方式都是支持的: {for $var=$start to $end}步长1的简单循环. {for $var=$start t ...

  2. 【转】在Ubuntu 12.04 上为Virtualbox 启用USB 设备支持--不错

    原文网址:http://www.cnblogs.com/ericsun/archive/2013/06/10/3130679.html 虚拟机我一直在用,不是说离不开Windows,而是有些时候一些应 ...

  3. cf500B New Year Permutation

    B. New Year Permutation time limit per test 2 seconds memory limit per test 256 megabytes input stan ...

  4. 精美实用的jQuery插件精选

    jQuery的确是一款相当强大的Javascript框架,同时jQuery的插件就多入牛毛,如果你善于收集,那么你在写前端页面的时候肯定会更加方便.本文精选了一些精美实用的jQuery插件供大家参考. ...

  5. 组播报文转发过程RPF

    单播报文的转发过程中,路由器并不关心组播源地址,只关心报文中的目的地址,通过目的地址决定向哪个接口转发.在组播中,报文是发送给一组接收者的,这些接收者用一个逻辑地址标识.路由器在接收到报文后,必须根据 ...

  6. 【转】YUV值对应的颜色

    版权声明:本文为博主原创文章,未经博主允许不得转载.欢迎大家积极评论,博主会一一答复! 最近有人在网上问我,YUV的值对应的颜色是如何的 下面给出YUV值对应的颜色关系 256张图512x512,每张 ...

  7. JavaScript 去除数组重复成员

    [...new Set(array)] 运用 Set结构不会添加重复的值 和...解构 function dedupe(array) { return Array.from(new Set(array ...

  8. LeetCode::Remove Duplicates from Sorted List II [具体分析]

    Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numb ...

  9. 解决从github下载web的源代码部署到eclipse的问题

    2015年6月2日 天气晴 github官网:https://github.com/ 以下以pdf.js作为案例说明:https://github.com/mozilla/pdf.js 1).点击案例 ...

  10. 网页HTML

    <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8&quo ...