题目大意:
添加和删除一个数,然后输出中位数。
简单的Splay 维护Splay上有多少个节点就可以了
#include
#include
#define inf 1LL<<60
#define maxn 222222
#define keyTree (ch[ch[root][1]][0])
using namespace std;
typedef long...
分类:
其他好文 时间:
2014-05-07 07:46:42
阅读次数:
405
题目大意:
给出m个询问,问【l,r】之间的和 ,求出有多少次询问不和之前的矛盾的。
思路分析:
用并查集记录当前节点到根节点的和。
#include
#include
#include
#include
#define maxn 222222
using namespace std;
int set[maxn];
int sum[maxn];
in...
分类:
其他好文 时间:
2014-05-07 07:35:05
阅读次数:
386
题意:经典Nim游戏博弈,给你n堆牌,每堆a[i]张,每次能从一堆中取出任一张(不能为0),最后不能取者为输
问先手有几种取法保证他最后能获胜。
思路:让Nim_sum=0(a[1]^a[2]…………^a[n]=0)时则输,利用这个定理,对于第i堆a[i],除了第i堆,其它的
Nim_sum=k,如果a[i]>k,则先手从第i堆可以取a[i]-k张牌,让a[i]=k,最后a[i]^k...
分类:
编程语言 时间:
2014-05-07 06:13:32
阅读次数:
428
[Question]
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to t...
分类:
其他好文 时间:
2014-05-07 05:37:44
阅读次数:
278
1.mysql的安装配置
linux下有一个很神奇的东西叫yum,只要有源,用yum来安装是一件非常容易的事,什么都不用管,它会为你解决好一些软件依赖的问题。一键安装mysql:
[root@localhost ~]# yum install mysql-server mysql-devel
安装完成后我们就可以使用mysql了:
[root@localho...
分类:
数据库 时间:
2014-05-07 05:04:06
阅读次数:
456
删除
RB-TRANSPLANT(T,u,v)函数是将u子树用v来代替,在替换的时候分为了三种情况,如果u就是root结点则直接替换u,如果树里面还包含有其它结点,则将u的左右子树转移到v的左右子树上面。
RB-TRANSPLANT(T,u,v)
if u.p == T.nil
T.root = v
else if u == u.p.left
u.p.left = v
e...
分类:
其他好文 时间:
2014-05-07 04:34:13
阅读次数:
474
./cbbackup http://192.168.1.112:8091 /backups/20140505 -u Administrator -p password -b misc
scp -r /backups/* root@58.61.xx.xx:/backups
./cbrestore /backups/20140505 http://Administrator:password@58...
分类:
其他好文 时间:
2014-05-06 19:07:13
阅读次数:
433
NYOJ 640 Geometric Sum...
分类:
其他好文 时间:
2014-05-06 15:20:32
阅读次数:
229
【Question】
Given an array S of n integers, are there elements a, b, c in S such
that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in ...
分类:
其他好文 时间:
2014-05-06 14:57:29
阅读次数:
318