首页 > 代码库 > ZOJ 3765 Lights Splay Tree的几种基本操作

ZOJ 3765 Lights Splay Tree的几种基本操作

区间的查询,点修改,插入和删除。先姑且当作模板吧,略挫,慢慢补充,慢慢优化。

#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <cmath>
#include <stack>
#include <map>

#pragma comment(linker, "/STACK:1024000000");
#define EPS (1e-8)
#define LL long long
#define ULL unsigned long long
#define _LL __int64
#define _INF 0x3f3f3f3f
#define Mod 9999991

using namespace std;

const int MAXN = 700100;

struct N
{
    //info
    int son[2],pre;

    //data
    int sta,ls,rs,s;
    int w,g[2];
    bool mark[2];

}st[MAXN];

struct W
{
    int sta,w;
}num[200100];

void Output(int root)
{
    if(root == -1)
        return ;
    Output(st[root].son[0]);
    printf("root = %d pre = %d data = http://www.mamicode.com/%2d lg = %2d rg = %2d sta = %2d ls = %d rs = %d s = %d/n",root,st[root].pre,st[root].w,st[root].g[0],st[root].g[1],st[root].sta,st[root].ls,st[root].rs,st[root].s);>