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 **/ //测试数 ...
随机推荐
- IDEA复制项目操作
- Python初探list
今天要说一个新概念--list,中文可以翻译成列表,是用来处理一组有序项目的数据结构.想象一下你的购物清单.待办工作.手机通讯录等等,它们都可以看作是一个列表.说它是新概念也不算确切,因为我们之前已经 ...
- java用swing画可以行走的乌龟
代码如下: import java.awt.Color;import java.awt.Graphics;import java.awt.event.KeyEvent;import java.awt. ...
- 卸载win10内置的onenote
powershell命令如下 get-appxpackage *onenote* | remove-appxpackage
- python---使用二叉堆实现的优先队列(列表)
哟,有实用价值 可以看到,加入是随机的,而吐出是顺序的. # coding = utf-8 # 使用二叉堆实现的优先队列(列表) class BinaryHeap: def __init__(self ...
- #Plugin 数字滚动累加动画插件
数字滚动累加动画插件 NumScroll 1.使用前先引入jquery2.前端学习群:814798690 下载地址 https://github.com/chaorenzeng/jquery.num ...
- jmeter4.x centos7部署笔记
1. jmeter依赖 java8或以上版本 安装 java : 参考 https://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/ ...
- javaScript事件(七)事件类型之键盘与文本事件
键盘事件如下: keydown:当用户按下键盘上的任意键时触发,而且如果按住不放的话,会重复触发此事件. keypress:当用户按下键盘上的字符键时触发,而且如果按住不放的话,会重复触发此事件. k ...
- jquery自定义事件
触发事件: $(document).trigger('REMOVE_WEBSITE_MSG'); 判断消息条数为0,触发这个
- python全栈开发day67--字段类型、字段属性、ORM回顾
一.回顾总结 https://www.cnblogs.com/maple-shaw/articles/9323320.html 1. 视图 1. CBV 和 FBV from django.views ...