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 **/ //测试数 ...
随机推荐
- ZenMap扫描笔记
1.软件界面如下,ZenMap 扫描工具是kali linu中对WEB渗透扫描的一款工具
- 数据增强(每10度进行旋转,进行一次增强,然后对每张图片进行扩充10张patch,最后得到原始图片数*37*10数量的图片)
# -*- coding: utf-8 -*-"""Fourmi Editor This is a temporary script file.""& ...
- .NET编码解码(HtmlEncode与HtmlDecode)
编码代码: System.Web.HttpUtility.HtmlEncode("<a href=\"http://hovertree.com/\">何问起& ...
- Python关键字及其用法
Python有哪些关键字 -Python常用的关键字 and, del, from, not, while, as, elif, global, or, with, assert, else, if ...
- Python初探list
今天要说一个新概念--list,中文可以翻译成列表,是用来处理一组有序项目的数据结构.想象一下你的购物清单.待办工作.手机通讯录等等,它们都可以看作是一个列表.说它是新概念也不算确切,因为我们之前已经 ...
- Ubuntu下Gradle环境配置
sudo gedit ~/.profile sudo source ~/.profile env # for java export JAVA_HOME=/home/cmm/jdk export CL ...
- Win10任务栏通知区域上已卸载程序无效图标选项如何清除?
在Win10系统中,大部分用户都已经知道在“选择在任务栏上显示哪些图标”来让一些软年图标显示,一些隐藏,不过使用Win10系统久了之后发现,在设置通知区域图标中有很多已经卸载程序的无效选项!这让设置时 ...
- python爬虫实例
import re import requests from bs4 import BeautifulSoup # 主方法 def main(): # 给请求指定一个请求头来模拟chrome浏览器 h ...
- bzoj 2832
题解: 首先有一个比较显然的事情是如果我们确定了买的次数这道题就可以简单的贪心了 但是答案和买的次数是什么关系呢.. 好像是可以三分的 所以应该是单峰的 这里用了模拟退火,而且是没有处理失败情况的模拟 ...
- Azure 国内版 如何用powershell修改linux系统的密码
国内版不像国际版本那样,一个UI按钮就解决问题,国内版很多功能上线比较慢,我们只能用powershell工具进行命令行 式的更改,也当温习一下命令了,好久不用了. $vm = Get-AzureVM ...