想了半天式子...最后在邓大师的帮助下想出此题....QWQ我还是太菜了 对于一个非割点,ans+=2*(n-1); 对于一个割点,ans+= #include<cstdio> #include<iostream> #define R register int using namespace std; ,M=; inline int g() { R ret=,fix=; register :fix; +(ch^); while(isdigit(ch=getchar())); ret…
题目链接:https://www.luogu.org/problemnew/show/P3469 #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define ll long long using namespace std; const int maxn = 500000 + 10; ll n, m, ans[maxn]; ll dfn[maxn]…
tarjan找割点..不是割点答案就是(N-1)*2, 是割点的话就在tarjan的时候顺便统计一下 ------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> using namespace std; typedef long long ll; co…
P3469 [POI2008]BLO-Blockade https://www.luogu.org/problem/P3469 题目描述 There are exactly nn towns in Byteotia. Some towns are connected by bidirectional roads. There are no crossroads outside towns, though there may be bridges, tunnels and flyovers. Ea…
[BZOJ 3110] [luogu 3332] [ZJOI 2013]k大数查询(权值线段树套线段树) 题面 原题面有点歧义,不过从样例可以看出来真正的意思 有n个位置,每个位置可以看做一个集合. 1 a b c :在a-b的每个集合中插入一个数c 2 a b c :2:询问将a-b的每个集合合并到一起后所有元素的第c大 分析 外层用权值线段树维护值,内层用普通线段树维护位置 我们先考虑全局询问第k大的情况,显然只需要权值线段树维护全局值的出现情况,区间[L,R]存储值落在[L,R]内的元素数…
#include <iostream> #include <cstring> #include <cstdio> using namespace std; typedef long long ll; ; ; int dfn[maxn], low[maxn], head[maxn]; ll ans[maxn], siz[maxn]; int n, m, tot, num, root; bool cut[maxn]; struct edge{ int to, next; }…