Description 公元 2044 年,人类进入了宇宙纪元. L 国有 n 个星球,还有 n−1 条双向航道,每条航道建立在两个星球之间,这 n−1 条航道连通了 L 国的所有星球. 小 P 掌管一家物流公司, 该公司有很多个运输计划,每个运输计划形如:有一艘物流飞船需要从 ui 号星球沿最快的宇航路径飞行到 vi 号星球去.显然,飞船驶过一条航道是需要时间的,对于航道 j,任意飞船驶过它所花费的时间为 tj,并且任意两艘飞船之间不会产生任何干扰. 为了鼓励科技创新, L 国国王同意小 P…
会卡vector. ; int n, m, Ans; ], to[maxn * ], tot; int vis[maxn], f[maxn]; int d[maxn], sum[maxn]; vector<int> q[maxn]; inline void Add(int u, int v) { to[++tot] = v, nxt[tot] = head[u], head[u] = tot; } inline int getf(int v) { return v == f[v] ? v :…
#include <bits/stdc++.h> using namespace std; #define int long long const int N = 1000005; vector <int> g[N]; int f[N],dis[N],fa[N][20],vis[N],n,m,t1,t2,t3,t4,ps[N],pt[N],lc[N],ans; int a[N],d[N]; void dfs1(int p) { vis[p] = 1; for (int i = 0;…
Network Description Yixght is a manager of the company called SzqNetwork(SN). Now she's very worried because she has just received a bad news which denotes that DxtNetwork(DN), the SN's business rival, intents to attack the network of SN. More unfort…
题目描述 Farmer John has installed a new system of pipes to transport milk between the stalls in his barn (), conveniently numbered . Each pipe connects a pair of stalls, and all stalls are connected to each-other via paths of pipes. FJ is pumping milk…
闇の連鎖(yam.pas/c/cpp)题目描述传说中的暗之连锁被人们称为 Dark.Dark 是人类内心的黑暗的产物,古今中外的勇者们都试图打倒它.经过研究,你发现 Dark 呈现无向图的结构,图中有 N 个节点和两类边,一类边被称为主要边,而另一类被称为附加边.Dark 有 N – 1条主要边,并且 Dark 的任意两个节点之间都存在一条只由主要边构成的路径.另外,Dark 还有 M 条附加边.你的任务是把 Dark 斩为不连通的两部分.一开始 Dark的附加边都处于无敌状态,你只能选择一条主…
这居然是我第一次写线段树合并--所以我居然在合并的时候加点结果WAWAWAMLEMLEMLE--!ro的时候居然直接指到la就行-- 树上差分,每个点建一棵动态开点线段树,然后统计答案的时候合并即可 #include<iostream> #include<cstdio> #include<queue> using namespace std; const int N=100005; int n,m,h[N],cnt,de[N],fa[N],si[N],hs[N],fr[…
P3128 [USACO15DEC]最大流Max Flow 题目描述 Farmer John has installed a new system of pipes to transport milk between the stalls in his barn (), conveniently numbered . Each pipe connects a pair of stalls, and all stalls are connected to each-other via path…