1. #include<queue>
  2. #include<vector>
  3. #include<cstdio>
  4. #include<algorithm>
  5. #define pc putchar
  6. #define gc getchar()
  7. #define rep(a,b,c) for(int a = b;a <= c;++ a)
  8. #define per(a,b,c) for(int a = b;a >= c;-- a)
  9. inline int read() {
  10. int x = 0,f = 1;
  11. char c = gc;
  12. while(c < '0' || c > '9') c = gc;
  13. while(c <= '9' && c >= '0') x = x * 10 + c - '0',c = gc;
  14. return x * f ;
  15. }
  16. void print(int x) {
  17. if(x < 0) {
  18. pc('-'); x = -x;
  19. }
  20. if(x >= 10) print(x / 10);
  21. pc(x % 10 + '0');
  22. }
  23. const int maxn = 100007;
  24. int a[maxn << 1];
  25. struct node {
  26. int v,next;
  27. bool cut;
  28. } edge[maxn << 1];
  29. int head[maxn],num = 1;
  30. inline void add_edge(int u,int v) {
  31. edge[++ num].v = v; edge[num].next = head[u];head[u] = num;
  32. e[num].cut = 0 ;
  33. }
  34. bool vis[maxn];
  35. void tarjan(int x,int fa) {
  36. low[x] = dfn[x] = ++ index;
  37. stk[++ top] = x;
  38. vis[x] = 1;
  39. for(int i = head[x];i;i = edge[i].next) {
  40. int v = edge[i].v;
  41. if(v == fa) continue;
  42. if(!dfn[v]) {
  43. tarjan(v,x);
  44. low[x] = std::min(low[x],low[v]);
  45. if(low[v] > dfn[u]) {
  46. bridge ++;
  47. edge[i].cut = true;
  48. edge[i ^ 1].cut = true;
  49. }
  50. }
  51. else if(vis[v] && low[u] > dfn[v])
  52. low[u] = dfn[v];
  53. }
  54. if(dfn[x] == low[x]) {
  55. }
  56. void solve() {
  57. n = read();m = read();
  58. for(int u,v,i = 1;i <= m;++ i) {
  59. u = read(),v = read();
  60. add_edge(u,v);
  61. add_edge(v,u);
  62. }
  63. memset(dfn,0,sizeof dfn);
  64. top = block = index = bridge = 0;
  65. for(int i = 1;i <= n;++ i) if(!dfn[i]) tarjan(i,i);
  66. }
  67. int main() {
  68. int t = read();
  69. for(int i = 1;i <= t;++ i) {
  70. memset(head,0,szieof head); num = 0;
  71. solve();
  72. }
  73. }

code——tmp的更多相关文章

  1. (转)android 蓝牙通信编程

    转自:http://blog.csdn.net/pwei007/article/details/6015907 Android平台支持蓝牙网络协议栈,实现蓝牙设备之间数据的无线传输. 本文档描述了怎样 ...

  2. [python]沪深龙虎榜数据进一步处理,计算日后5日的涨跌幅

    沪深龙虎榜数据进一步处理,计算日后5日的涨跌幅 事前数据: 前面处理得到的csv文件 文件名前加入“[wait]”等待程序处理 python代码从雅虎股票历史数据api获取数据,计算后面5日的涨跌幅 ...

  3. [python]数据整理,将取得的众多的沪深龙虎榜数据整一整

    将昨日取得的众多的沪深龙虎榜数据整一整 提取文件夹内所有抓取下来的沪深龙虎榜数据,整理出沪深两市(含中小创)涨幅榜股票及前5大买入卖出资金净值,保存到csv文件 再手动使用数据透视表进行统计 原始数据 ...

  4. 在Linux操作系统下备份恢复技术的应用 转自https://yq.aliyun.com/articles/50205?spm=5176.100239.blogcont24250.9.CfBYE9

    摘要: 安全防护:在Linux操作系统下备份恢复技术的应用  原文参见:http://linux.chinaunix.net/techdoc/system/2005/12/19/925898.shtm ...

  5. FLASH结构

    mergedir/code.tmp.bin 压缩未加密文件的FLASH文件 mergedir/sfs/nvm.bin   shareData数据文件,未加密.未压缩 数据克隆:DATA/ALL APP ...

  6. php utf-8字符转ascii字符

    function utf8_urldecode($str) { $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\ ...

  7. 世界城市 XML

    下载地址:http://www.qlcoder.com/uploads/dd01140921/147988679320159.xml <Location> <CountryRegio ...

  8. 插头DP专题

    建议入门的人先看cd琦的<基于连通性状态压缩的动态规划问题>.事半功倍. 插头DP其实是比较久以前听说的一个东西,当初是水了几道水题,最近打算温习一下,顺便看下能否入门之类. 插头DP建议 ...

  9. UVa1593_Allgnment_Of_Code

    /** start: integer; // begins hear stop: integer; // ends here s: string; c: char; // temp **/ //测试数 ...

随机推荐

  1. 数据库MySql的安装

    1.MySQL概述 MySQL最初是由“MySQL AB公司”开发的一套关系型数据库管理系统(RDBMS-Relation DataBase Management System).MySQL不仅是最流 ...

  2. Python函数之内置函数

    截止导Python 3.6 目前内置函数有68个 以下是对这些内置函数的分类 一:作用域相关 以字典的形式返回作用域中的名字 locals # 返回本地作用域的所有名字 globals # 返回全局作 ...

  3. Win10如何禁止软件运行?win10禁止软件启动的设置方法!禁止人生日历热点快讯的方法

    相信不少使用Win10系统的用户遇到过下载了一款软件进行安装后后续会有接连不断的程序安装到电脑中.他可能似乎一个大家常用的程序,在我们安装好运行的时候会通过后台偷偷下载其他应用安装到我们电脑中,导致系 ...

  4. TFS 生成任务报错:目录不是空的

    转到代理目录下,将生成文件夹清空,重新启动生成任务即可

  5. 【bzoj4976】宝石镶嵌

    题解: 比较水 注意k<=100这个条件 当n-k比较大的时候 我们显然会把它有的位都给取了 不然的话我们可以考虑dp 暴力状压就可以了 代码: #include <bits/stdc++ ...

  6. bzoj2018年5月赛

    题解: 老早之前看的并没有写题解.. t1: 我刚开始想的是线段树来维护.. 看了题解发现直接二分就行了 很容易发现因数只会有30个 那么我们就统计每一种因数在这段区间的个数 然后开个vector记录 ...

  7. BeautifulSoup下Unicode乱码解决

    今天在用scrapy爬某个网站的数据,其中DOM解析我用的是BeautifulSoup,速度上没有XPath来得快,不过因为用了习惯了,所以一直用的bs,版本是bs4 不过在爬取过程中遇到了一些问题, ...

  8. Asp.Net Mvc 返回类型总结

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...

  9. net core体系-web应用程序-4asp.net core2.0 项目实战(1)-1目录

    Asp.Net Core 2.0 项目实战(1) NCMVC开源下载了 Asp.Net Core 2.0 项目实战(2)NCMVC一个基于Net Core2.0搭建的角色权限管理开发框架 Asp.Ne ...

  10. 借助CSS Shapes实现元素滚动自动环绕iPhone X的刘海

    CSS代码: .box { max-width: 414px; height: 480px; border: solid #000; margin: auto; overflow: auto; } . ...