一、洛谷普通平衡树模板题。。。。题目不好复制。
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<string>
#include<cmath>
#include<queue>
#include<map>
#include<vector>
#define ll long long
#define llu unsigned ll
using namespace std;
const double alpha=0.75;
const int maxn=100100;
const int inf=0x3f3f3f3f;
struct node
{
int val;
int lc,rc;
int h;
int si;
}t[maxn];
int tot,root;
void pushup(int p)
{
t[p].h=max(t[t[p].lc].h,t[t[p].rc].h)+1;
t[p].si=t[t[p].lc].si+t[t[p].rc].si+1;
}
int getb(int p)
{
return t[t[p].lc].h-t[t[p].rc].h;
}
int newnode(int x)
{
int p=++tot;
t[p].lc=t[p].rc=0;
t[p].h=t[p].si=1;
t[p].val=x;
return p;
}
void R(int &p)
{
int q=t