code——tmp
#include<queue>
#include<vector>
#include<cstdio>
#include<algorithm>
#define pc putchar
#define gc getchar()
#define rep(a,b,c) for(int a = b;a <= c;++ a)
#define per(a,b,c) for(int a = b;a >= c;-- a)
inline int read() {
int x = 0,f = 1;
char c = gc;
while(c < '0' || c > '9') c = gc;
while(c <= '9' && c >= '0') x = x * 10 + c - '0',c = gc;
return x * f ;
}
void print(int x) {
if(x < 0) {
pc('-'); x = -x;
}
if(x >= 10) print(x / 10);
pc(x % 10 + '0');
}
const int maxn = 100007;
int a[maxn << 1];
struct node {
int v,next;
bool cut;
} edge[maxn << 1];
int head[maxn],num = 1;
inline void add_edge(int u,int v) {
edge[++ num].v = v; edge[num].next = head[u];head[u] = num;
e[num].cut = 0 ;
}
bool vis[maxn];
void tarjan(int x,int fa) {
low[x] = dfn[x] = ++ index;
stk[++ top] = x;
vis[x] = 1;
for(int i = head[x];i;i = edge[i].next) {
int v = edge[i].v;
if(v == fa) continue;
if(!dfn[v]) {
tarjan(v,x);
low[x] = std::min(low[x],low[v]);
if(low[v] > dfn[u]) {
bridge ++;
edge[i].cut = true;
edge[i ^ 1].cut = true;
}
}
else if(vis[v] && low[u] > dfn[v])
low[u] = dfn[v];
}
if(dfn[x] == low[x]) {
}
void solve() {
n = read();m = read();
for(int u,v,i = 1;i <= m;++ i) {
u = read(),v = read();
add_edge(u,v);
add_edge(v,u);
}
memset(dfn,0,sizeof dfn);
top = block = index = bridge = 0;
for(int i = 1;i <= n;++ i) if(!dfn[i]) tarjan(i,i);
}
int main() {
int t = read();
for(int i = 1;i <= t;++ i) {
memset(head,0,szieof head); num = 0;
solve();
}
}
code——tmp的更多相关文章
- (转)android 蓝牙通信编程
转自:http://blog.csdn.net/pwei007/article/details/6015907 Android平台支持蓝牙网络协议栈,实现蓝牙设备之间数据的无线传输. 本文档描述了怎样 ...
- [python]沪深龙虎榜数据进一步处理,计算日后5日的涨跌幅
沪深龙虎榜数据进一步处理,计算日后5日的涨跌幅 事前数据: 前面处理得到的csv文件 文件名前加入“[wait]”等待程序处理 python代码从雅虎股票历史数据api获取数据,计算后面5日的涨跌幅 ...
- [python]数据整理,将取得的众多的沪深龙虎榜数据整一整
将昨日取得的众多的沪深龙虎榜数据整一整 提取文件夹内所有抓取下来的沪深龙虎榜数据,整理出沪深两市(含中小创)涨幅榜股票及前5大买入卖出资金净值,保存到csv文件 再手动使用数据透视表进行统计 原始数据 ...
- 在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 ...
- FLASH结构
mergedir/code.tmp.bin 压缩未加密文件的FLASH文件 mergedir/sfs/nvm.bin shareData数据文件,未加密.未压缩 数据克隆:DATA/ALL APP ...
- php utf-8字符转ascii字符
function utf8_urldecode($str) { $str = preg_replace("/%u([0-9a-f]{3,4})/i","&#x\\ ...
- 世界城市 XML
下载地址:http://www.qlcoder.com/uploads/dd01140921/147988679320159.xml <Location> <CountryRegio ...
- 插头DP专题
建议入门的人先看cd琦的<基于连通性状态压缩的动态规划问题>.事半功倍. 插头DP其实是比较久以前听说的一个东西,当初是水了几道水题,最近打算温习一下,顺便看下能否入门之类. 插头DP建议 ...
- UVa1593_Allgnment_Of_Code
/** start: integer; // begins hear stop: integer; // ends here s: string; c: char; // temp **/ //测试数 ...
随机推荐
- 数据库MySql的安装
1.MySQL概述 MySQL最初是由“MySQL AB公司”开发的一套关系型数据库管理系统(RDBMS-Relation DataBase Management System).MySQL不仅是最流 ...
- Python函数之内置函数
截止导Python 3.6 目前内置函数有68个 以下是对这些内置函数的分类 一:作用域相关 以字典的形式返回作用域中的名字 locals # 返回本地作用域的所有名字 globals # 返回全局作 ...
- Win10如何禁止软件运行?win10禁止软件启动的设置方法!禁止人生日历热点快讯的方法
相信不少使用Win10系统的用户遇到过下载了一款软件进行安装后后续会有接连不断的程序安装到电脑中.他可能似乎一个大家常用的程序,在我们安装好运行的时候会通过后台偷偷下载其他应用安装到我们电脑中,导致系 ...
- TFS 生成任务报错:目录不是空的
转到代理目录下,将生成文件夹清空,重新启动生成任务即可
- 【bzoj4976】宝石镶嵌
题解: 比较水 注意k<=100这个条件 当n-k比较大的时候 我们显然会把它有的位都给取了 不然的话我们可以考虑dp 暴力状压就可以了 代码: #include <bits/stdc++ ...
- bzoj2018年5月赛
题解: 老早之前看的并没有写题解.. t1: 我刚开始想的是线段树来维护.. 看了题解发现直接二分就行了 很容易发现因数只会有30个 那么我们就统计每一种因数在这段区间的个数 然后开个vector记录 ...
- BeautifulSoup下Unicode乱码解决
今天在用scrapy爬某个网站的数据,其中DOM解析我用的是BeautifulSoup,速度上没有XPath来得快,不过因为用了习惯了,所以一直用的bs,版本是bs4 不过在爬取过程中遇到了一些问题, ...
- Asp.Net Mvc 返回类型总结
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...
- 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 ...
- 借助CSS Shapes实现元素滚动自动环绕iPhone X的刘海
CSS代码: .box { max-width: 414px; height: 480px; border: solid #000; margin: auto; overflow: auto; } . ...