并查集
思路别人的
再设一个sex数组
记录与其性别不同的bug的编号
如果已经记录了
则将其和记录的值并到一起
以为性别相同
路漫漫其修远兮
下句忘了。。。
#include
#include
int set[2005];
int sex[2005];
int temp;
int find(int x)
{
return set[x]==x?x:set[...
分类:
其他好文 时间:
2015-08-07 11:05:25
阅读次数:
80
题目:Given aWeathertable, write a SQL query to find all dates' Ids with higher temperature compared to its previous (yesterday's) dates.+---------+-----...
分类:
数据库 时间:
2015-08-07 10:48:11
阅读次数:
166
其实就是把下载失败的文件夹给删除了,再下载。 Linux: $ find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \; Windows: > cd %userprofile%\.m2\repository
> f...
分类:
其他好文 时间:
2015-08-07 09:44:20
阅读次数:
117
Linux的五个查找命令1. find 最常见且最强大的命令,可以查找任何文件。格式$ find 指定目录 指定条件 指定动作指定目录: 所要搜索的目录及其子目录,默认当前目录。指定条件: 所要搜索的文件的特征。指定动作: 对搜索结果进行特定的处理。提醒:如果什么参数都不给,find默认在当前...
分类:
系统相关 时间:
2015-08-07 06:57:50
阅读次数:
170
Given an array of integers and an integerk, find out whether there there are two distinct indicesiandjin the array such thatnums[i] = nums[j]and the d...
分类:
其他好文 时间:
2015-08-07 00:18:17
阅读次数:
115
4.6 Write an algorithm to find the'next'node (i.e., in-order successor) of a given node in a binary search tree. You may assume that each node has a l...
分类:
其他好文 时间:
2015-08-07 00:10:52
阅读次数:
112
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr...
分类:
其他好文 时间:
2015-08-07 00:09:44
阅读次数:
174
Given an integer array of sizen, find all elements that appear more than? n/3 ?times. The algorithm should run in linear time and in O(1) space.解法:参考编...
分类:
其他好文 时间:
2015-08-06 23:52:02
阅读次数:
201
和vector一样,map也可以看作一种特殊的数组,vector是不限定长度的数组,map是可以不开中间位置元素空间的数组。map常见的函数:m.insert(pair) //插入一对数据
m.size() //返回容器中元素的个数
m.count(key) //返回key键是否出现过
m.find(key) //寻找key键元素,返回到迭代器
m.erase(pos)...
分类:
其他好文 时间:
2015-08-06 22:30:49
阅读次数:
173
Given an unsorted integer array, find the first missing positive integer.
For example,
Given [1,2,0] return 3,
and [3,4,-1,1] return 2.
Your algorithm should run in O(n) time and uses constant...
分类:
其他好文 时间:
2015-08-06 22:29:49
阅读次数:
175