LOJ #6034. 「雅礼集训 2017 Day2」线段游戏(李超线段树)

题目
主席树套李超树。
一开始以为空间是 O ( n log ⁡ 2 n ) O(n\log^2n) O(nlog2n)的。
然后发现这个神奇的数据结构(李超树)是 O ( n ) O(n) O(n)空间的。。。。
注意不要往李超树里面加斜率不存在的线段,好像处理不了的样子,在外面简单维护即可。
时间复杂度 O ( n log ⁡ 2 n ) O(n\log ^2n) O(nlog2n)
A C   C o d e \mathrm {AC \ Code} AC Code

#include<bits/stdc++.h>
#define maxn 100005
#define maxp 8000006
#define rep(i,j,k) for(int i=(j);i<=k;i++)
#define TC 1,1,100000
#define db double 
#define Ct const 
using namespace std;

int n,m;
int rt[maxn<<2],mxh[maxn],hdp[maxn];

char cb[1<<15],*cs=cb,*ct=cb;
#define getc() (cs==ct&&(ct=(cs=cb)+fread(cb,1,1<<15,stdin),cs==ct)?0:*cs++)
void read(int &res){
   
	char ch;bool f=0;
	for(;!isdigit(ch=getc());) if(ch=='-') f=1;
	for(res=ch-'0';isdigit(ch=getc());res=res*10+ch-'0');
	(f) && (res=-res);
}
struct Line{
   
	int x[2],y[2];
	db caly(db a)Ct{
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值