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…
一道经典的割点例题,用size数组记录该子树有多少个节点,sum是这棵搜索树上有多少个节点,sum*(n-sum-1)是将点删掉后的数对数量. #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #define maxn 1000010 using namespace std; typedef long long ll; inline int read() { ;…
题目描述 The first stage of train system reform (that has been described in the problem Railways of the third stage of 14th Polish OI. However, one needs not be familiar with that problem in order to solve this task.) has come to an end in Byteotia. The…
BLO-Blockade 题目链接 若一个点为割点:统计出每个子树的大小,两两相乘再相加, 再加上n-1,为这个点与其他点的拜访数, 因为拜访是互相的,最后再乘二即可 若一个点不是割点:只有(n-1)*2次拜访会受影响 #include<cstdio> #define LL long long #define N 100010 #define M 1000010 #define min(a,b) ((a)<(b)?(a):(b)) int n,m,dfn[N],low[N],size[N…