P6136 【模板】普通平衡树(数据加强版)

这篇博客探讨了在洛谷题P6136中遇到的数据加强版平衡树问题。作者对比了自己的解决方案(SBT)与排名更高的WBLT算法,尽管SBT运行较快,但对为何其他排名更高的解决方案能更快感到疑惑。
摘要由CSDN通过智能技术生成

题目如同洛谷普通平衡树。
数据加强,
题解rank1是 WBLT 写的,本来想学一下,但是我这个 SBT 跑的还是蛮快的,就不学了。
目前洛谷rank3,可是rank1,rank2都是SBT 写的。。为啥比我的要快。。

#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;


char buffer[100001], * S, * T;
inline char Get_Char()
{
   
    if (S == T)
    {
   
        T = (S = buffer) + fread(buffer, 1, 100001, stdin);
        if (S == T) return EOF;
    }
    return *S++;
}
inline int read()
{
   
    char c;int re = 0;
    for (c = Get_Char();c < '0' || c>'9';c = Get_Char());
    while (c >= '0' && c <= '9') re = re * 10 + (c - '0'), c = Get_Char();
    return re;
}


const double alpha = 0.75;
const int maxn = 1100100;
const int inf = 0x7fffffff;
struct node
{
   
    int val;
    int lc, rc;
    int si;
}t[maxn];
int tot, root;


void pushup(int p)
{
   
    t[p].si = t[t[p].lc].si + t[t[p].rc].si + 1;
}


int newnode(int x)
{
   
    int p = ++tot;
    t[p
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值