3224: Tyvj 1728 普通平衡树(新板子)
3224: Tyvj 1728 普通平衡树
Time Limit: 10 Sec Memory Limit: 128 MB
Submit: 17048 Solved: 7429
[Submit][Status][Discuss]
Description
您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作:
1. 插入x数
2. 删除x数(若有多个相同的数,因只删除一个)
3. 查询x数的排名(若有多个相同的数,因输出最小的排名)
4. 查询排名为x的数
5. 求x的前驱(前驱定义为小于x,且最大的数)
6. 求x的后继(后继定义为大于x,且最小的数)
Input
第一行为n,表示操作的个数,下面n行每行有两个数opt和x,opt表示操作的序号(1<=opt<=6)
Output
对于操作3,4,5,6每行输出一个数,表示对应答案
Sample Input
1 106465
4 1
1 317721
1 460929
1 644985
1 84185
1 89851
6 81968
1 492737
5 493598
Sample Output
84185
492737
HINT
code
2018-07-01
#include<cstdio>
#include<cctype> const int N = ; int siz[N],ch[N][],fa[N],cnt[N],data[N];
int Root,tn; #define ls ch[p][0]
#define rs ch[p][1] int son(int x) {
return x==ch[fa[x]][];
}
void pushup(int p) {
siz[p] = siz[ls] + siz[rs] + cnt[p];
}
void rotate(int x) {
int y = fa[x],z = fa[y],b = son(x),c = son(y),a = ch[x][!b];
if (z) ch[z][c] = x;else Root = x;fa[x] = z;
ch[x][!b] = y;fa[y] = x;
ch[y][b] = a;if (a) fa[a] = y;
pushup(y),pushup(x);
}
void splay(int x,int rt) {
while (fa[x] != rt) {
int y = fa[x],z = fa[y];
if (z==rt) rotate(x);
else {
if (son(x)==son(y)) rotate(y),rotate(x);
else rotate(x),rotate(x);
}
}
}
int getrnk(int x) {
int p = Root,ans = ;
while (true) {
if (!p) return ans + ;
if (x == data[p]) {ans += siz[ls];splay(p,);return ans+;}
if (x < data[p]) p = ls;
else {
ans += siz[ls] + cnt[p];
p = rs;
}
}
}
int getkth(int k) {
int p = Root;
while (true) {
if (siz[ls] < k && k <= siz[ls] + cnt[p]) return data[p];
if (k <= siz[ls]) p = ls;
else {
k -= siz[ls] + cnt[p];
p = rs;
}
}
}
int Newnode(int pa,int d) {
++tn;siz[tn] = cnt[tn] = ;ch[tn][] = ch[tn][] = ;
data[tn] = d;fa[tn] = pa;
return tn;
}
void Insert(int x) {
if (!Root) {Root = Newnode(,x);return ;}
int p = Root,pa = ;
while (true) {
if (data[p]==x) {
cnt[p] ++;pushup(p);pushup(pa);splay(p,);return ; // Splay ?????????????????
}
pa = p; // ??!
p = ch[p][x > data[p]];
if (!p) {
p = Newnode(pa,x);
ch[pa][x > data[pa]] = p;
pushup(p),pushup(pa);splay(p,);
break;
}
}
}
void Clear(int p) {
siz[p] = cnt[p] = ch[p][] = ch[p][] = fa[p] = data[p] = ;
}
void Delete(int x) {
getrnk(x);
int &p = Root,tmp;
if (cnt[p]) {cnt[p]--;pushup(p);return ;}
if (!ls && !rs) {Clear(p);Root = ;return ;}
if (!ls || !rs) {tmp = p;p = ls?ls:rs;fa[p] = ;Clear(tmp);return ;}
int pre = ls;
while (ch[pre][]) pre = ch[pre][];
tmp = p;p = pre;
splay(p,);
ch[p][] = ch[tmp][];fa[ch[tmp][]] = p;
Clear(tmp);pushup(p);
}
int main() {
int T,opt,x;
scanf("%d",&T);
while (T--) {
scanf("%d%d",&opt,&x);
if (opt==) Insert(x);
else if (opt==) Delete(x);
else if (opt==) printf("%d\n",getrnk(x));
else if (opt==) printf("%d\n",getkth(x));
else if (opt==) printf("%d\n",getkth(getrnk(x)-));
else printf("%d\n",getkth(getrnk(x+)));
}
}
持续更新2018-05-02
#include<cstdio>
#include<cctype> const int N = ; int siz[N],ch[N][],fa[N],cnt[N],data[N];
int Root,tn; #define ls ch[p][0]
#define rs ch[p][1] int son(int x) {
return x==ch[fa[x]][];
}
void pushup(int p) {
siz[p] = siz[ls] + siz[rs] + cnt[p];
}
void rotate(int x) {
int y = fa[x],z = fa[y],b = son(x),c = son(y),a = ch[x][!b];
if (z) ch[z][c] = x;else Root = x;fa[x] = z;
ch[x][!b] = y;fa[y] = x;
ch[y][b] = a;if (a) fa[a] = y;
pushup(y),pushup(x);
}
void splay(int x,int rt) {
while (fa[x] != rt) {
int y = fa[x],z = fa[y];
if (z==rt) rotate(x);
else {
if (son(x)==son(y)) rotate(y),rotate(x);
else rotate(x),rotate(x);
}
}
}
int getrnk(int k) {
int p = Root,ans = ;
while (true) {
if (!p) return ans + ; // 没有这个点
if (k < data[p]) p = ls;
else {
ans += (ls?siz[ls]:);
if (k == data[p]) {
splay(p,);return ans + ;
}
ans += cnt[p];
p = rs;
}
}
}
int getkth(int k) {
int p = Root;
while (true) {
if (k <= siz[ls]) p = ls;
else {
k -= ls?siz[ls]:;
if (k<=cnt[p]) return data[p];
k -= cnt[p];
p = rs;
}
}
}
int Newnode(int pa,int d) {
++tn;siz[tn] = cnt[tn] = ;ch[tn][] = ch[tn][] = ;
data[tn] = d;fa[tn] = pa;
return tn;
}
void Insert(int x) {
if (!Root) {Root = Newnode(,x);return ;}
int p = Root,pa = ;
while (true) {
if (data[p]==x) {
cnt[p] ++;pushup(p);pushup(pa);splay(p,);return ; // Splay 为了更新新新加入节点后产生的变化。
}
pa = p; // 顺序!
p = ch[p][x > data[p]];
if (!p) {
p = Newnode(pa,x);
ch[pa][x > data[pa]] = p;
pushup(p),pushup(pa);splay(p,);
break;
}
}
}
void Clear(int p) {
siz[p] = cnt[p] = ch[p][] = ch[p][] = fa[p] = data[p] = ;
}
void Delete(int x) {
getrnk(x);
int &p = Root,tmp;
if (cnt[p]) {cnt[p]--;pushup(p);return ;}
if (!ls && !rs) {Clear(p);Root = ;return ;}
if (!ls || !rs) {tmp = p;p = ls?ls:rs;fa[p] = ;Clear(tmp);return ;}
int pre = ls;
while (pre) pre = ch[pre][];
tmp = p;p = pre;
splay(p,);
ch[p][] = ch[tmp][];fa[ch[tmp][]] = p;
Clear(tmp);pushup(p);
}
int main() {
int T,opt,x;
scanf("%d",&T);
while (T--) {
scanf("%d%d",&opt,&x);
if (opt==) Insert(x);
else if (opt==) Delete(x);
else if (opt==) printf("%d\n",getrnk(x));
else if (opt==) printf("%d\n",getkth(x));
else if (opt==) printf("%d\n",getkth(getrnk(x)-));
else printf("%d\n",getkth(getrnk(x+)));
}
}
再一次更新2018-05-01
#include<cstdio>
#include<cctype> const int N = ;
int fa[N],ch[N][],siz[N],cnt[N],data[N];
int tn,Root; inline int read() {
int x = ,f = ;char ch = getchar();
for (; !isdigit(ch); ch=getchar()) if(ch=='-') f=-;
for (; isdigit(ch); ch=getchar()) x = x*+ch-'';
return x * f;
}
#define ls ch[p][0]
#define rs ch[p][1]
inline int son(int x) {
return x == ch[fa[x]][]; // -
}
inline void pushup(int x) {
siz[x] = siz[ch[x][]] + siz[ch[x][]] + cnt[x];
}
void rotate(int x) {
int y = fa[x],z = fa[y],b = son(x),c = son(y),a = ch[x][!b];
if (z) ch[z][c] = x;else Root = x;fa[x] = z; // 调整x的位置
ch[x][!b] = y;fa[y] = x; // 调整y的位置
ch[y][b] = a;if (a) fa[a] = y; // 给y另一个子节点
pushup(y);pushup(x);
}
void splay(int x,int rt) {
while (fa[x] != rt) {
int y = fa[x],z = fa[y];
if (z==rt) rotate(x);
else {
if (son(x)==son(y)) rotate(y),rotate(x);
else rotate(x),rotate(x);
}
}
}
int getrnk(int k) { // 得到k的排名,位置
int p = Root,ans = ;
while (true) {
if (p == ) return ans + ;
if (k < data[p]) p = ls;
else {
ans += (ls ? siz[ls] : );
if (k==data[p]) {
splay(p,);return ans+;
}
ans += cnt[p];
p = rs;
}
}
}
int getkth(int k) { // 得到第k个数
int p = Root;
while (true) {
if (ls && k <= siz[ls]) p = ls;
else {
int tmp = (ls ? siz[ls] : ) + cnt[p];
if (k <= tmp) return data[p];
k -= tmp; p = rs;
}
}
}
void newnode(int x,int pa,int d) {
ch[x][] = ch[x][] = ;siz[x] = cnt[x] = ;
data[x] = d;fa[x] = pa;
}
inline void Insert(int x) { // 插入
if (Root==) {
++tn; Root = tn;newnode(tn,,x);return;
}
int p = Root,pa = ;
while (true) {
if (x==data[p]) {
cnt[p]++;pushup(p);pushup(pa);splay(p,);break;
}
pa = p;
p = ch[p][x > data[p]];
if (p==) {
p = ++tn;newnode(p,pa,x);
ch[pa][x > data[pa]] = p;
pushup(pa),splay(p,);break;
}
}
}
inline void Clear(int x) {
ch[x][] = ch[x][] = fa[x] = siz[x] = cnt[x] = data[x] = ;
}
inline void Delete(int x) { // 删除
getrnk(x);
int &p = Root;
if (cnt[p] > ) {cnt[p]--;pushup(p);return;}
if (!ls && !rs) {Clear(p);p = ;return;}
if (!ls || !rs) {
int tmp = p;p = ls==?rs:ls;fa[p] = ;Clear(tmp);return;
}
int tmp = p,pre = ls; // 找根节点的前一个-左子树的最右边
while (ch[pre][]) pre = ch[pre][];
splay(pre,);
rs = ch[tmp][];fa[ch[tmp][]] = p;
Clear(tmp);
pushup(p);
}
int main() {
int n = read();
while (n--){
int opt = read(),x = read();
if (opt==) Insert(x);
else if (opt==) Delete(x);
else if (opt==) printf("%d\n",getrnk(x));
else if (opt==) printf("%d\n",getkth(x));
else if (opt==) printf("%d\n",getkth(getrnk(x)-));
else printf("%d\n",getkth(getrnk(x+)));
}
return ;
}
更新了下板子
#include<cstdio> const int N = ;
int fa[N],ch[N][],siz[N],cnt[N],data[N];
int tn,Root; inline char nc() {
static char buf[],*p1 = buf,*p2 = buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,,,stdin),p1==p2) ? EOF :*p1++;
}
inline int read() {
int x = ,f = ;char ch=nc();
for (; ch<''||ch>''; ch = nc())
if (ch == '-') f = -;
for (; ch>=''&&ch<=''; ch = nc())
x = x*+ch-'';
return x * f;
}
inline int son(int x) {
return x == ch[fa[x]][]; // -
}
inline void pushup(int x) {
siz[x] = siz[ch[x][]] + siz[ch[x][]] + cnt[x];
}
inline void rotate(int x) {
int y = fa[x],z = fa[y],b = son(x),c = son(y),a = ch[x][!b];
if (z) ch[z][c] = x;else Root = x;fa[x] = z; // 调整x的位置
ch[x][!b] = y;fa[y] = x; // 调整y的位置
ch[y][b] = a;if (a) fa[a] = y; // 给y另一个子节点
pushup(y);pushup(x);
}
inline void splay(int x,int rt) {
while (fa[x] != rt) {
int y = fa[x],z = fa[y];
if (z==rt) rotate(x);
else {
if (son(x)==son(y)) rotate(y),rotate(x);
else rotate(x),rotate(x);
}
}
}
inline int getpre(int x) { //得到第一个比x小的数
int p = Root,ans;
while (p) {
if (x <= data[p]) p = ch[p][];
else ans = p,p = ch[p][];
}
return ans;
}
inline int getsuc(int x) { // 得到第一个比x大的数
int p = Root,ans;
while (p) {
if (x >= data[p]) p = ch[p][];
else ans = p,p = ch[p][];
}
return ans;
}
inline int getk(int k) { // 得到k的排名
int p = Root,ans = ;
while (true) {
if (k < data[p]) p = ch[p][];
else {
ans += (ch[p][] ? siz[ch[p][]] : );
if (k==data[p]) {
splay(p,);return ans+;
}
ans += cnt[p];
p = ch[p][];
}
}
}
inline int getkth(int k) { // 得到第k个数
int p = Root;
while (true) {
if (ch[p][] && k <= siz[ch[p][]]) p = ch[p][];
else {
int tmp = (ch[p][] ? siz[ch[p][]] : ) + cnt[p];
if (k <= tmp) return data[p];
k -= tmp; p = ch[p][];
}
}
}
inline void Insert(int x) { // 插入
if (Root==) {
++tn; Root = tn;
ch[tn][] = ch[tn][] = fa[tn] = ;
siz[tn] = cnt[tn] = ;data[tn] = x;
return;
}
int p = Root,pa = ;
while (true) {
if (x==data[p]) {
cnt[p]++;pushup(p);pushup(pa);splay(p,);break;
}
pa = p;
p = ch[p][x > data[p]];
if (p==) {
tn++;
ch[tn][] = ch[tn][] = ;siz[tn] = cnt[tn] = ;
fa[tn] = pa;ch[pa][x > data[pa]] = tn;data[tn] = x; //-
pushup(pa),splay(tn,);break;
}
}
}
inline void Clear(int x) {
ch[x][] = ch[x][] = fa[x] = siz[x] = cnt[x] = data[x] = ;
}
inline void Delete(int x) { // 删除
getk(x);
if (cnt[Root] > ) {cnt[Root]--;pushup(Root);return;}
if (!ch[Root][] && !ch[Root][]) {Clear(Root);Root = ;return;}
if (!ch[Root][]) {
int tmp = Root;Root = ch[Root][];fa[Root] = ;Clear(tmp);return;
}
else if (!ch[Root][]) {
int tmp = Root;Root = ch[Root][];fa[Root] = ;Clear(tmp);return;
}
int tmp = Root,pre = ch[Root][];//可以是getpre(data[Root]);等价于下面的while
while (ch[pre][]) pre = ch[pre][];
splay(pre,);
ch[Root][] = ch[tmp][];
fa[ch[tmp][]] = Root;
Clear(tmp);
pushup(Root);
}
int main() {
int n = read();
while (n--){
int opt = read(),x = read();
if (opt==) Insert(x);
else if (opt==) Delete(x);
else if (opt==) printf("%d\n",getk(x));
else if (opt==) printf("%d\n",getkth(x));
else if (opt==) printf("%d\n",data[getpre(x)]);
else printf("%d\n",data[getsuc(x)]);
}
return ;
}
另一种写法,放一下吧
#include<cstdio> const int N = ;
int fa[N],ch[N][],siz[N],cnt[N],data[N];
int tn,Root; inline char nc() {
static char buf[],*p1 = buf,*p2 = buf;
return p1==p2&&(p2=(p1=buf)+fread(buf,,,stdin),p1==p2) ? EOF :*p1++;
}
inline int read() {
int x = ,f = ;char ch=nc();
for (; ch<''||ch>''; ch = nc())
if (ch == '-') f = -;
for (; ch>=''&&ch<=''; ch = nc())
x = x*+ch-'';
return x * f;
}
inline int son(int x) {
return x == ch[fa[x]][]; // -
}
inline void pushup(int x) {
siz[x] = siz[ch[x][]] + siz[ch[x][]] + cnt[x];
}
inline void rotate(int x) {
int y = fa[x],z = fa[y],b = son(x),c = son(y),a = ch[x][!b];
if (z) ch[z][c] = x;else Root = x;fa[x] = z; // 调整x的位置
ch[x][!b] = y;fa[y] = x; // 调整y的位置
ch[y][b] = a;if (a) fa[a] = y; // 给y另一个子节点
pushup(y);pushup(x);
}
inline void splay(int x,int rt) {
while (fa[x] != rt) {
int y = fa[x],z = fa[y];
if (z==rt) rotate(x);
else {
if (son(x)==son(y)) rotate(y),rotate(x);
else rotate(x),rotate(x);
}
}
}
inline int getpre(int x) { //得到第一个比x小的数
int p = ch[Root][];
while (ch[p][]) p = ch[p][];
return p;
}
inline int getsuc(int x) { // 得到第一个比x大的数
int p = ch[Root][];
while (ch[p][]) p = ch[p][];
return p;
}
inline int getk(int k) { // 得到k的排名
int p = Root,ans = ;
while (true) {
if (k < data[p]) p = ch[p][];
else {
ans += (ch[p][] ? siz[ch[p][]] : );
if (k==data[p]) {
splay(p,);return ans+;
}
ans += cnt[p];
p = ch[p][];
}
}
}
inline int getkth(int k) { // 得到第k个数
int p = Root;
while (true) {
if (ch[p][] && k <= siz[ch[p][]]) p = ch[p][];
else {
int tmp = (ch[p][] ? siz[ch[p][]] : ) + cnt[p];
if (k <= tmp) return data[p];
k -= tmp; p = ch[p][];
}
}
}
inline void Insert(int x) { // 插入
if (Root==) {
++tn; Root = tn;
ch[tn][] = ch[tn][] = fa[tn] = ;
siz[tn] = cnt[tn] = ;data[tn] = x;
return;
}
int p = Root,pa = ;
while (true) {
if (x==data[p]) {
cnt[p]++;pushup(p);pushup(pa);splay(p,);break;
}
pa = p;
p = ch[p][x > data[p]];
if (p==) {
tn++;
ch[tn][] = ch[tn][] = ;siz[tn] = cnt[tn] = ;
fa[tn] = pa;ch[pa][x > data[pa]] = tn;data[tn] = x; //-
pushup(pa),splay(tn,);break;
}
}
}
inline void Clear(int x) {
ch[x][] = ch[x][] = fa[x] = siz[x] = cnt[x] = data[x] = ;
}
inline void Delete(int x) { // 删除
getk(x);
if (cnt[Root] > ) {cnt[Root]--;pushup(Root);return;}
if (!ch[Root][] && !ch[Root][]) {Clear(Root);Root = ;return;}
if (!ch[Root][]) {
int tmp = Root;Root = ch[Root][];fa[Root] = ;Clear(tmp);return;
}
else if (!ch[Root][]) {
int tmp = Root;Root = ch[Root][];fa[Root] = ;Clear(tmp);return;
}
int tmp = Root,pre = ch[Root][];//可以是getpre(data[Root]);等价于下面的while
while (ch[pre][]) pre = ch[pre][];
splay(pre,);
ch[Root][] = ch[tmp][];
fa[ch[tmp][]] = Root;
Clear(tmp);
pushup(Root);
}
int main() {
int n = read();
while (n--){
int opt = read(),x = read();
if (opt==) Insert(x);
else if (opt==) Delete(x);
else if (opt==) printf("%d\n",getk(x));
else if (opt==) printf("%d\n",getkth(x));
else if (opt==) Insert(x),printf("%d\n",data[getpre(x)]),Delete(x);
else Insert(x),printf("%d\n",data[getsuc(x)]),Delete(x);
}
return ;
}
没有重复数字的情况:
getk和getkth函数
// 只在没有重复数字是使用
inline int getk(int k) {
int p = Root,ans = ;
while (true) {
if (k == data[p]) {splay(p,);return ans+;}
if (k < data[p]) p = ch[p][];
else {
ans += (ch[p][] ? siz[ch[p][]] : ) + ;
p = ch[p][];
}
}
}
inline int getkth(int k) {
int p = Root;
while (true) {
if (k == siz[ch[p][]]+) return p;
if (ch[p][] && k <= siz[ch[p][]]) p = ch[p][];
else {
k -= ((ch[p][] ? siz[ch[p][]] : ) + );
p = ch[p][];
}
}
}
insert,delete
inline void Insert(int x) {
if (Root==) {
++tn;Root = tn;
ch[tn][] = ch[tn][] = fa[tn] = ;
siz[tn] = ;data[tn] = x;
return ;
}
int p = Root,pa = ;
while (true) {
pa = p;
p = ch[p][x > data[p]];
if (p==) {
++tn;
ch[tn][] = ch[tn][] = ;fa[tn] = pa;
ch[pa][x > data[pa]] = tn;
siz[tn] = ;data[tn] = x;
pushup(pa),splay(tn,);break;
}
}
}
inline void Clear(int x) {
ch[x][] = ch[x][] = fa[x] = siz[x] = data[x] = ;
}
inline void Delete(int x) {
getk(x);
if (!ch[Root][] && !ch[Root][]) { Clear(Root);Root = ;return;}
if (!ch[Root][]) {
int tmp = Root;Root = ch[Root][];fa[Root] = ;Clear(tmp);return;
}
else if (!ch[Root][]) {
int tmp = Root;Root = ch[Root][];fa[Root] = ;Clear(tmp);return;
}
int tmp = Root,pre = ch[Root][];
while (ch[pre][]) pre = ch[pre][];
splay(pre,);
ch[Root][] = ch[tmp][];
fa[ch[tmp][]] = Root;
Clear(tmp);
pushup(Root);
}
查找大于等于x的数或者小于等于:
getpre和getsuc函数
//这两个函数可以等于查找的数
inline int getpre(int x) { // 返回第一个小于等于x的数
int p = Root,ans = ;
while (p) {
if (x < data[p]) p = ch[p][];
else ans = p,p = ch[p][];
}
return ans;
}
inline int getsuc(int x) { // 返回第一个大于等于x的数
int p = Root,ans = ;
while (p) {
if (x > data[p]) p = ch[p][];
else ans = p,p = ch[p][];
}
}
getpre,getsuc函数另一种操作:
getpre(x):找x的前驱,首先找到x的排名k = getk(x),然后求出排名为k-1的数:pre=getkth(k-1);
getsuc同理
3224: Tyvj 1728 普通平衡树(新板子)的更多相关文章
- BZOJ 3224 Tyvj 1728 普通平衡树 | Splay 板子+SPlay详细讲解
下面给出Splay的实现方法(复杂度证明什么的知道是 nlogn 就可以啦) 首先对于一颗可爱的二叉查找树,是不能保证最坏nlogn的复杂度(可以想象把一个升序序列插入) (二叉查找树保证左子树元素大 ...
- BZOJ 3224 TYVJ 1728 普通平衡树 [Treap树模板]
3224: Tyvj 1728 普通平衡树 Time Limit: 10 Sec Memory Limit: 128 MB Submit: 7390 Solved: 3122 [Submit][S ...
- BZOJ 3224: Tyvj 1728 普通平衡树 or 洛谷 P3369 【模板】普通平衡树-Splay树模板题
3224: Tyvj 1728 普通平衡树 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 22483 Solved: 10130[Submit][S ...
- BZOJ 3224: Tyvj 1728 普通平衡树
3224: Tyvj 1728 普通平衡树 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 9629 Solved: 4091[Submit][Sta ...
- BZOJ 3224: Tyvj 1728 普通平衡树 treap
3224: Tyvj 1728 普通平衡树 Description 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作:1. 插入x数2. 删除x数(若有多个相同的数,因只删除 ...
- BZOJ 3224: Tyvj 1728 普通平衡树 vector
3224: Tyvj 1728 普通平衡树 Description 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作:1. 插入x数2. 删除x数(若有多个相同的数,因只删除 ...
- BZOJ 3224: Tyvj 1728 普通平衡树(BST)
treap,算是模板题了...我中间还一次交错题... -------------------------------------------------------------------- #in ...
- 【bzoj】3224: Tyvj 1728 普通平衡树
3224: Tyvj 1728 普通平衡树 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 10097 Solved: 4302[Submit][St ...
- 3224: Tyvj 1728 普通平衡树(finger tree)
3224: Tyvj 1728 普通平衡树 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 19122 Solved: 8359[Submit][St ...
随机推荐
- FirstAFNetWorking
// ViewController.h // FirstAFNetWorking // // Created by 张国锋 on 15/7/20. // Copyright (c) 2015年 张国锋 ...
- 基于WebSocket和SpringBoot的群聊天室
引入 普通请求-响应方式:例如Servlet中HttpServletRequest和HttpServletResponse相互配合先接受请求.解析数据,再发出响应,处理完成后连接便断开了,没有数据的实 ...
- 使用js获取复选框的值,并把数组传回后台处理,过程使用的是Ajax异步查询
这是界面代码: function shua(){ var id_array=new Array(); $('input[id="checkAll& ...
- spring data jpa自定义baseRepository
在一些特殊时候,我们会设计到对Spring Data JPA中的方法进行重新实现,这将会面临一个问题,如果我们新创建一个实现类.如果这个实现类实现了JpaRepository接口,这样我们不得不实现该 ...
- intelliJ idea 激活和配置
1. 双击打开 Intellij IDEA 桌面快捷方式图标,如下图: 2. 点击 ok 按钮,进入激活页面: 3. 他提供的三种方式激活:账号激活,激活码激活,服务器地址激活,我们选择激活码激活,去 ...
- (转)VC得到可用的串口列表
//枚举串口 //参数:bEnablePort,哪个串口有效,bEnablePort[0]表示COM1,bEnablePort[n-1]表示COMn //返回值:有效的串口个数 int EnumAll ...
- [Git]使用Git上传本地项目,并同步到Github上
第一步:先要在github.com中创建一个仓库(New Repository). 第二步,打开Git Bash ① git init [+仓库名]:初始化仓库,执行之后可以在指定的仓库存放地上面看到 ...
- 感觉单链表是实现BCL ICollection 的最佳方式,所有操作都能以最小的时间复杂度完成
public interface ICollection<T> : IEnumerable<T>, IEnumerable { int Count { get; }// ...
- [torch] torch.contiguous
torch.contiguous 作用 连续存储,因为view的操作要求的是连续的内容. 详细 考虑下面的操作,transpose操作只是改变了stride,而实际数组存储的内容并没有得到任何改变,即 ...
- 使用Timer组件实现倒计时
实现效果: 知识运用: Timer组件的Enabed属性 实现代码: private void timer1_Tick(object sender, EventArgs e) { DateTime ...