题目大意:给出n个数,要求将n个数分配到两个集合中,集合0中的元素x,要求A-x也再0中,同理1集合。
写了几个版本,一直WA在第8组数据...最后参考下ans,写了并查集过了
学到:1、注意离散的逻辑思维,官方答案的 从条件推逆否命题
2、并查集做法:fa[find(i)]=mp[a-p[i]]
? find(a-p[i]) :
find(n+2);
3、离散化然后has...
分类:
其他好文 时间:
2014-09-28 18:42:35
阅读次数:
240
[leetcode] Latest added:2014-09-23Find the contiguous subarray within an array (containing at least one number) which has the largest product.For exam...
分类:
编程语言 时间:
2014-09-28 01:51:00
阅读次数:
499
The backlog has an effect on the maximum rate at which a server can accept new TCP connections on a socket. The rate is a function of both the backlog value and the time that connections stay on th...
分类:
其他好文 时间:
2014-09-28 00:32:21
阅读次数:
301
1 // 帮助实现单例设计模式 2 3 // .h文件的实现 4 #define SingletonH(methodName) + (instancetype)shared##methodName; 5 6 // .m文件的实现 7 #if __has_feature(objc_arc) //...
分类:
其他好文 时间:
2014-09-27 01:55:29
阅读次数:
196
Description
The “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Robotics”. «U.S. R...
分类:
其他好文 时间:
2014-09-26 22:34:29
阅读次数:
370
#2006 - MySQL server has gone away
对于web应用来说,经常会用到mysql,而数据的备份与还原是web应用经常做的事,一般来说,用客户端工具phpmyadmin,sqlyog 等,来备份数据库没有任何问题,还原时经常碰到mysql提示的#2006错误。
Error: 2006 (CR_SERVER_GONE_ERROR)
Message:...
分类:
数据库 时间:
2014-09-26 20:42:58
阅读次数:
231
Description
Farmer John has noticed that the quality of milk given by his cows varies from day to day. On further investigation, he discovered that although he can't predict the quality of milk f...
分类:
其他好文 时间:
2014-09-26 19:26:18
阅读次数:
234
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous subarray [2,3] has the larges...
分类:
其他好文 时间:
2014-09-26 15:03:38
阅读次数:
359
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous subarray [2,3] has the larges...
分类:
其他好文 时间:
2014-09-26 01:16:58
阅读次数:
271
题目信息:
1014. Waiting in Line (30)
时间限制
400 ms
内存限制
32000 kB
代码长度限制
16000 B
判题程序
Standard
作者
CHEN, Yue
Suppose a bank has N windows op...
分类:
其他好文 时间:
2014-09-25 23:02:28
阅读次数:
271