并查集的基础概念及实现 部分内容引用自wikipedia.org 并查集(Union Find Sets)是一种树型的数据结构,用于处理一些不相交集合的合并及查询问题,定义了两个用于此数据结构的操作: Find:确定元素属于哪一个子集。它可以被用来确定两个元素是否属于同一子集。 Union:将两个子 ...
分类:
其他好文 时间:
2018-02-23 22:24:02
阅读次数:
150
题目描述 Farmer John has a large farm with NN barns (1 \le N \le 10^51≤N≤105 ), some of which are already painted and some not yet painted. Farmer John wa ...
分类:
其他好文 时间:
2018-02-17 19:40:50
阅读次数:
141
4746: Xiangqi 时间限制(普通/Java):1000MS/3000MS 内存限制:65536KByte 总提交: 15 测试通过:2 描述 Xiangqi is one of the most popular two-player board games in China. The ga ...
分类:
其他好文 时间:
2018-02-15 21:28:28
阅读次数:
261
In a proper unit test we want to isolate external dependencies as much as possible to guarantee a reliable test outcome. Http calls represent such ext ...
分类:
Web程序 时间:
2018-02-14 21:56:37
阅读次数:
273
CF43A Football CF43A Football CF43A Football 题意翻译 题目大意 两只足球队比赛,现给你进球情况,问哪支队伍赢了。 第一行一个整数nn (1\leq n\leq 1001≤n≤100 ),表示有nn 次进球,接下来nn 行,每行一个长度不超过1010 ,只 ...
分类:
其他好文 时间:
2018-02-11 18:06:17
阅读次数:
173
quicksork 步骤: shuffle (needed for performance guarantee) partition (scan i and j, repeat until i and j pointers cross. at last, exchange a[lo] with a[ ...
分类:
其他好文 时间:
2018-01-07 22:08:41
阅读次数:
225
Implement int sqrt(int x). Compute and return the square root of x. x is guaranteed to be a non-negative integer. Example 1: Example 2: 时间复杂度:O(logn) ...
分类:
其他好文 时间:
2018-01-04 16:28:49
阅读次数:
189
The idea is to use two arrays len[n] and cnt[n] to record the maximum length of Increasing Subsequence and the coresponding number of these sequence w ...
分类:
其他好文 时间:
2017-12-13 02:09:20
阅读次数:
115
Description: Implement int sqrt(int x). Compute and return the square root of x. x is guaranteed to be a non-negative integer. Example 1: Example 2: 解 ...
分类:
其他好文 时间:
2017-12-05 20:07:02
阅读次数:
108
The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flatopia. The Flatopia ...
分类:
其他好文 时间:
2017-11-30 20:13:30
阅读次数:
221