poj 1823 Hotel 线段树
来源:互联网 发布:大津算法 matlab 编辑:程序博客网 时间:2024/06/05 09:46
这个题目意思很简单,就是求连续的最长段。
查询次数比较多,时间卡的比较紧
之前写了个k*logn*logn的,结果tle了,pushup的时候如果每次都修改到满节点时pushup的话,因为一个区间最多被分成logn次,加上每次pushup最多执行logn次操作,所以复杂度就高了
其实更简单一点的方法是当修改了一个节点的局部时,就重新修改该节点的值。这样复杂度就变低了,这样看起来,真的还是得多思考,线段树貌似多种修改都是采取后面的方法会快得多。
讲讲具体思路: 非常简单,lamx,rmax,max分别表示左连续最大,右连续最大,连续最大。
#include <iostream>
#include <stdio.h>
#include <string.h>
#define ls t<<1
#define rs t<<1|1
#define midt(tr[t].l+tr[t].r)>>1
using namespace std;
const int maxn=16000+10;
struct
{
}tr[maxn*4];
inline int max(int a,int b)
{
}
int maketree(int t,int l,int r)
{
}
void pushdown(int t)
{
}
void modify(int t,int l,int r,int tmp)
{
}
int main()
{
}
- POJ 1823 Hotel 线段树
- POJ 1823 Hotel 线段树
- poj 1823 Hotel 线段树
- POJ 1823 Hotel【线段树】
- POJ 1823 Hotel(线段树)
- poj Hotel 线段树
- POJ 1823 Hotel 线段树 + lazy标签
- poj 1823 Hotel (分段线段树)
- [POJ 1823] Hotel 线段树区间合并
- poj 1823 hotel(线段树)
- POJ 3667 Hotel(线段树)
- 【线段树】poj 3667 Hotel
- POJ 3667 Hotel 线段树
- poj 3667 hotel #线段树
- POJ-3667 Hotel[线段树]
- POJ 3667 HOTEL 线段树
- POJ 3667 Hotel (线段树)
- poj 3667 Hotel 线段树
- EBS R12中重新enable失效用户之后,丢失职责
- poj 1177 Picture 线段树加扫描线
- 客户端脚本验证码总结
- poj 2104 K-th Num…
- poj 3468 A Simple…
- poj 1823 Hotel 线段树
- poj 3667 hotel 线段树…
- poj 3277 City Horizon 线段树
- PHP语言实现验证码
- 一点点感想
- poj 3225 Help with Intervals
- poj 1925 Spiderman
- poj 1850 Code 递推
- poj 1952 BUY LOW, BUY LOWER dp