码迷,mamicode.com
首页 >  
搜索关键字:并查集 hdu    ( 34854个结果
并查集
初始化 #include <numeric> vector<int> father(MAX); iota(father.begin() + 1, father.end(), 1); 查找根 int findFather(int u) { if (father[u] == u) return u; e ...
分类:其他好文   时间:2020-07-19 23:36:50    阅读次数:60
G Operating on a Graph(并查集+临边染色)
题:https://ac.nowcoder.com/acm/contest/5668/G 题意:给定n点m边图,q个询问,每个询问为x颜色,若此时图上有x颜色的部分,这该部分临边的部分会被染成x颜色(有可能是一个点,有可能是同种颜色的子图) 分析:因为一种颜色只能由一次覆盖临边的机会,所以每次操作只 ...
分类:其他好文   时间:2020-07-18 22:27:50    阅读次数:100
hdu 4283You Are the One
The TV shows such as You Are the One has been very popular. In order to meet the need of boys who are still single, TJUT hold the show itself. The sho ...
分类:其他好文   时间:2020-07-18 00:42:55    阅读次数:89
HDU-3553 Just a String (二分 + 后缀数组)
题意:找出文本串中字典序第 k 大的字符串 思路: 首先我们不能仅仅按后缀数组排完序后每个字符串的大小来找,因为重复字符也参与排名,比如 AAB 2, 结果是 A 而不是 AA。 注:以下第 i 个后缀均指排完序后第 i 小的后缀。 所以我们二分找第 k 大的字符串位于哪个区间,假定我们现在确定目标 ...
分类:编程语言   时间:2020-07-17 22:05:37    阅读次数:71
[PAT] A1114 Family Property
并查集 ##题目大意 给出每个人名下的房产和家庭关系,求出每个家庭的总人数即人均房产数和房产面积。第一行输出家庭个数(所有有亲属关系的人都属于同一个家庭)。随后按下列格式输出每个家庭的信息:家庭成员的最小编号 家庭人口数 人均房产套数 人均房产面积。其中人均值要求保留小数点后3位。家庭信息首先按人均 ...
分类:其他好文   时间:2020-07-17 16:03:28    阅读次数:69
HDU - 6581 Vacation (贪心+思维+物理)
Tom and Jerry are going on a vacation. They are now driving on a one-way road and several cars are in front of them. To be more specific, there are nn ...
分类:其他好文   时间:2020-07-17 09:30:42    阅读次数:82
HDU 2612 Find a way
Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a ...
分类:其他好文   时间:2020-07-17 01:14:23    阅读次数:90
游戏「并查集」
游戏「并查集」 题目描述 Mirko和 Slavko 爱玩弹球戏。在一个令人激动的星期五,Mirko 和 Slavko 玩了一把弹球游戏。Mirko 构建一个有向图,所有顶点最多有 1 条出边。弹球从 1个顶点出发可以沿着一条边移动到它的邻接点,只要它存在,而且它会继续移动到后者的邻接点去,直到最后 ...
分类:其他好文   时间:2020-07-16 22:01:22    阅读次数:76
常规并查集模板
常规并查集 模板 #define Maxsize 100+1 int f[Maxsize]; void init(int n){ for(int i = 1; i <= n; i++) f[i] = i; } int find_f(int a){ if(f[a] == a){ return a; } ...
分类:其他好文   时间:2020-07-16 11:58:56    阅读次数:105
HDU - 4027(线段树+剪枝)
一个数最多能取8-9次根号。 #include <bits/stdc++.h> using namespace std; #define debug printf("bug!!!\n"); typedef long long ll; const int MAXN=1e5+10; const ll M ...
分类:其他好文   时间:2020-07-16 10:11:53    阅读次数:74
34854条   上一页 1 ... 15 16 17 18 19 ... 3486 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!