博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
uva 796(求割边)
阅读量:6852 次
发布时间:2019-06-26

本文共 1100 字,大约阅读时间需要 3 分钟。

题意:在一张图中,让你求割边。并按照顺序数出来,注意图并不是连通的。

思路:对多个连通分支,每个执行一次dfs求割边。最后排序输出就好了。

代码如下:

1 #include 
2 #include
3 #include
4 #include
5 #include
6 #include
7 #include
8 #include
9 #include
10 #define MP(a, b) make_pair(a, b)11 #define PB(a) push_back(a)12 13 using namespace std;14 15 typedef long long ll;16 typedef pair
pii;17 typedef pair
puu;18 typedef pair
pid;19 typedef pair
pli;20 21 const int INF = 0x3f3f3f3f;22 const double eps = 1e-6;23 const int LEN = 1010;24 struct Arc{25 int from, to;26 }bri[LEN];27 int mp[LEN][LEN], n, nbri, low[LEN], dfn[LEN], dfs_clock, vis[LEN];28 vector
Map[LEN];29 inline bool cmp(Arc a, Arc b)30 {31 if(a.from != b.from) return a.from
dfn[u])bri[nbri].from = min(u, v), bri[nbri++].to = max(v, u);53 }54 }55 }56 57 int main()58 {59 // freopen("in.txt", "r", stdin);60 61 int from, to, tn;62 while(scanf("%d", &n)!=EOF)63 {64 memset(mp, 0 ,sizeof mp);65 for(int i=0; i
View Code

 

转载于:https://www.cnblogs.com/shu-xiaohao/p/3523073.html

你可能感兴趣的文章
链表的遍历
查看>>
微信小程序中的图形验证码
查看>>
数字转罗马数字
查看>>
CNN网络架构演进
查看>>
windows上安装Ipython notebook
查看>>
选择屏幕加功能码
查看>>
UIImagePickerController 视频录制操作,视频大小,时间长度
查看>>
Python Tuples
查看>>
Entity Framework 4 in Action读书笔记——第一章:数据访问重载:Entity Framework(3)...
查看>>
review过去的10年
查看>>
JAVA加密
查看>>
java.lang.NoSuchMethodError: org.apache.commons.io.FileUtils.getTempDirectory()Ljava/io/File;
查看>>
第三课:叠加法和戴维南法
查看>>
395. Longest Substring with At Least K Repeating Characters
查看>>
foreach 與 reference 的雷
查看>>
db2缓冲池调优
查看>>
Sicily_How can I go
查看>>
NYOJ_456_邮票分你一半
查看>>
NYOJ_44_子串和
查看>>
kafka整理笔记笔记
查看>>