摘要:
使用并查集的思想求最小生成树 复杂度O(mlogm) int n,m; struct edge{ int u,v,w; bool operator<(const edge&t)const{ return w<t.w; } edge(int uu,int vv,int weight):u(uu),v( 阅读全文
摘要:
求最小生成树,(指的是在一个加权无向图中找到一个边的子集,使得这个子集构成的树包含图中的所有顶点,并且边的权重之和最小。) 用于稠密图,复杂度O(mlogm) int n,m,cnt,ans; vector<pii>e[maxn];//{点,权重} int d[maxn],vis[maxn]; pr 阅读全文
摘要:
题目链接:https://www.acwing.com/problem/content/description/5442/ 题意: 给定数组h,a,t,分别代表甘蔗高度,甘蔗每天能生长的高度,以及题目约束条件。 询问至少经过多少天,能使得对于所有的1<=i<=n,使得能有ti个甘蔗比第i个甘蔗高 思 阅读全文