摘要:
思路:将以桥为分界的所有连通分支进行缩点,得到一颗树,求出树的直径。再用树上的点减去直径,再减一#pragma comment(linker, "/STACK:1024000000,1024000000")#include#include#include#include#include#include#define Maxn 210110#define Maxm 2501000using namespace std;int index[Maxn],vi[Maxn],dfn[Maxn],low[Maxn],e,n,lab=0,Stack[Maxn],top,num,head[ 阅读全文
摘要:
思路:就是裸的最小树形图~#include#include#include#include#include#define Maxn 110#define LL double#define inf 1e9using namespace std;int pre[Maxn],id[Maxn],vi[Maxn],num;LL in[Maxn];struct Edge{ int u,v; LL val;}edge[Maxn*Maxn];struct Point{ double x,y;}p[Maxn];double Dis(Point a,Point b){ return sq... 阅读全文
摘要:
思路:将所有的直线的两个端点和城市混在一起,将能直接到达的两个点连线,求一次floyd最短路径。二分枚举bag容量,然后按给的要先后占领的城市由前向后,把能到一步到达的建一条边。然后求一次最小路径覆盖,就是最少需要多少个士兵才能全部占领,跟给出的p值进行比较。#include#include#include#include#include#define Maxn 510#define Maxm Maxn*Maxn#define eps 1e-6#define inf 100000000using namespace std;int match[Maxn],vi[Maxn],graphic[Ma 阅读全文