码迷,mamicode.com
首页 >  
搜索关键字:并查集 hdu    ( 34854个结果
HDU-1050 Moving Tables
The famous ACM (Advanced Computer Maker) Company has rented a floor of a building whose shape is in the following figure. The floor has 200 rooms each ...
分类:其他好文   时间:2020-02-13 22:47:12    阅读次数:94
ZOJ4109 Welcome Party
并查集算连通块的数量,集合的个数就是必然不开心的人数,再跑bfs,用优先队列维护~ #include<bits/stdc++.h> using namespace std; const int maxn=1e6+14; vector<int> g[maxn]; int father[maxn]; i ...
分类:其他好文   时间:2020-02-13 19:20:12    阅读次数:48
HDU 2049
"HDU 2049" 思路 从$n$ 个人中选出$m$个人进行错排,即${n \choose m}$, "递推求组合数" $m$个人的 "错排公式" $f[m]=(m 1)(f[m 1]+f[m 2])$ 答案:${n \choose m}f[m]$ ...
分类:其他好文   时间:2020-02-13 14:58:36    阅读次数:52
HDU 2044
"HDU 2044" 思路 首先要明白从 $a$ 到$b$ 和 从$a+n$ 到$b +n$的方案数是一样的 第$n$ 个蜂房只能由第$n 1$个蜂房和第$n 2$ 个蜂房转移过来。 $f[n]=f[n 1]+f[n 2]$ ...
分类:其他好文   时间:2020-02-13 10:09:18    阅读次数:46
HDU 2045
"HDU 2045" 思路 假设第 $n$ 个格子与第一个格子不同色,与第$n 1$个格子同色,则只能填一种颜色,$f[n 1] 1$ 假设第$n 1$ 个格子与第一个格子同色,则第$n$ 个格子可以填两种颜色,$f[n 2] 1 2$ $f[n]=2f[n 2]+f[n 1]$ ...
分类:其他好文   时间:2020-02-13 09:50:57    阅读次数:36
HDU - 2018
"HDU 2018 " 思路 打表,找规律, ...
分类:其他好文   时间:2020-02-13 09:44:05    阅读次数:45
Educational Codeforces Round 82 (Rated for Div. 2)
题外话 开始没看懂D题意跳了,发现F题难写又跳回来了。。 语文好差,码力好差 A 判第一个$1$跟最后一个$1$中$0$的个数即可 B 乘乘除除就完事了 C 用并查集判一下联通,每个联通块内必须为一条链 E 枚举$t$串的断点,然后$f_{i,j}$表示匹配到s串的第$i$个,$t$串的第一节的第$ ...
分类:其他好文   时间:2020-02-13 09:33:05    阅读次数:41
HDU 2047
"HDU 2047" 思路 考虑第 $n$ 位为 $F$ 或者 $E$ ,第 $n 1$ 位,可以填$3$ 个字母, $f[n] = 1 2f[n 1]$ 考虑第 $n$ 位为$O$ ,因为两个$O$ 不能相邻,所以,第 $n 1$ 位,只能填$2$ 个字母,第$n 2$ 可以填$3$个字母 $f[ ...
分类:其他好文   时间:2020-02-13 09:25:23    阅读次数:49
PAT A1114 Family Property
用并查集处理每个家庭的信息,注意标记~ #include<bits/stdc++.h> using namespace std; const int maxn=10010; bool visit[maxn]={false}; int N; struct node { int id; int chil ...
分类:其他好文   时间:2020-02-13 00:18:32    阅读次数:52
PAT A1034 Head Of Gang
用并查集分割团伙,判断输出~ #include<bits/stdc++.h> using namespace std; const int maxn=10010; int father[maxn],isRoot[maxn]={0},weight[maxn]; unordered_map<string ...
分类:其他好文   时间:2020-02-13 00:04:46    阅读次数:54
34854条   上一页 1 ... 64 65 66 67 68 ... 3486 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!