
并查集
文章平均质量分 81
m0_51864047
这个作者很懒,什么都没留下…
展开
-
POJ1733 Parity game(带边权、拓展域并查集)
Parity gamePOJ1733 Parity gameDescriptionNow and then you play the following game with your friend. Your friend writes down a sequence consisting of zeroes and ones. You choose a continuous subsequence (for example the subsequence from the third to the原创 2021-07-16 10:36:46 · 97 阅读 · 0 评论 -
PTA 特立独行的幸福(带权并查集)
L2-029 特立独行的幸福 (25 分)传送门对一个十进制数的各位数字做一次平方和,称作一次迭代。如果一个十进制数能通过若干次迭代得到 1,就称该数为幸福数。1 是一个幸福数。此外,例如 19 经过 1 次迭代得到 82,2 次迭代后得到 68,3 次迭代后得到 100,最后得到 1。则 19 就是幸福数。显然,在一个幸福数迭代到 1 的过程中经过的数字都是幸福数,它们的幸福是依附于初始数字的。例如 82、68、100 的幸福是依附于 19 的。而一个特立独行的幸福数,是在一个有限的区间内不依附于任何原创 2021-04-23 14:26:37 · 859 阅读 · 0 评论 -
POJ1456 Supermarket (贪心,二叉堆,并查集)
Supermarket传送门DescriptionA supermarket has a set Prod of products on sale. It earns a profit px for each product x∈Prod sold by a deadline dx that is measured as an integral number of time units starting from the moment the sale begins. Each product tak原创 2021-04-29 17:22:42 · 154 阅读 · 0 评论 -
Journey(线性dp、并查集)
There are n+1n+1n+1 cities, numbered from 000 to nnn. nnn roads connect these cities, the i-th road connects cities i−1i−1i−1 and i(i∈[1,n])i (i∈[1,n])i(i∈[1,n]).Each road has a direction. The directions are given by a string of nnn characters such that e原创 2021-08-08 16:00:57 · 158 阅读 · 0 评论 -
二叉查找树内置计数器(并查集的迭代器)
二叉查找树内置计数器祈枫是一个超级想(其实只要亿点点想,哼)加入ACM队的20级某专业学妹,可惜她需要先解决欠下的亿点点数据结构作业(为什么会有数据结构作业?)。 二叉查找树想必大家都不陌生,根节点的权值严格大于左儿子权值,严格小于右儿子权值。祈枫欠下的作业就与二叉查找树有关。作业里面有一份这样的伪代码:这份伪代码描述了二叉查找树的工作过程,并且加装了一个不知道干什么用的计数器。计数器的初始示数为−1,现在为了研究这个计数器的作用,祈枫决定按顺序插入一个n的排列,并要求在每次插入一个数后都输出一遍计数原创 2021-03-26 22:27:43 · 136 阅读 · 0 评论