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. COJ 0557 4013多重部分和问题

    4013多重部分和问题 难度级别:B: 运行时间限制:2000ms: 运行空间限制:262144KB: 代码长度限制:2000000B 试题描述 n种大小不同的数字 Ai,每种各Mi个,判断是否可以从 ...

  2. SPOJ--K-query (线段树离线) 离线操作解决一些问题

    K-query Given a sequence of n numbers a1, a2, ..., an and a number of k- queries. A k-query is a tri ...

  3. sql语句相关操作

    create user test identified by test default tablespace users temporary tablespace temp quota 3M on u ...

  4. Appium依据xpath获取控件实例随笔

    如文章<Appium基于安卓的各种FindElement的控件定位方法实践>所述,Appium拥有众多获取控件的方法.当中一种就是依据控件所在页面的XPATH来定位控件. 本文就是尝试通过 ...

  5. [ES6] Rest Parameter

    Problem with the ES5: function displayTags(){ for (let i in arguments) { let tag = arguments[i]; _ad ...

  6. linux shell 切换到ROOT用户

    #!/bin/bash expect -c "        set timeout 1000        spawn /bin/su - root         expect \&qu ...

  7. 2d-x中Lua类型强转问题

    在Lua中,使用CCDictionary进行保存CCSprite对象,但是,在CCDictionary取出来的时候,此时是一个CCObject对象,无法调用子类精灵的一些方法.那只能进行强转的. 那么 ...

  8. sun.misc.BASE64Encoder是内部专用 API, 可能会在未来发行版中删除

    简介 MEVAN打包遇到问题“sun.misc.BASE64Encoder是内部专用 API, 可能会在未来发行版中删除”,属于警告!项目虽然能正常运行,但是有警告就是一种隐患,要将隐患消灭在萌芽中. ...

  9. sys--system-sysdba-sysoper用户区别

    当Oracle 数据库安装完毕后,系统会自动创建sys和system这两个帐户.1.sys :缺省密码为CHANGE_ON_INSTALL ,且被授予DBA角色system :缺省密码为MANAGER ...

  10. GridView控件的光棒效应

    // 光棒效应 protected void gvBookInfos_RowDataBound(object sender, GridViewRowEventArgs e) { if(e.Row.Ro ...