
线段树
文章平均质量分 55
Napoleon2004
这个作者很懒,什么都没留下…
展开
-
HDU 1556 Color the ball
Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给每个气球涂一次颜色。但是N次以后lele已经忘记了第I个气球已经涂过几次颜色了,你能帮他算出每个气球被涂过几次颜色吗? Input每个测试实例第一行为一个整数N,(N <= 100000)...原创 2018-03-31 14:07:25 · 118 阅读 · 0 评论 -
POJ 3667 Hotel
#include<cstdio> #include<algorithm> using namespace std; const int M=50010; struct node{ int ls,rs,ms,pos,mark; }a[3*M]; void build(int i,int l,int r){ a[i].ls=r-l+1; a[i].rs=r-l+1; a...原创 2018-04-05 16:48:46 · 134 阅读 · 0 评论 -
POJ 2777
这道题一直很奇怪的RE,把数组大小从4倍改成2倍,3倍仍然RE,然后改成5倍,还是RE,最后改成6倍,居然AC了。不懂为啥大佬的数组开4倍可以过。。。#include<cstdio> #include<cstring> #include<algorithm> using namespace std; int tree[600040]; int laz[60004...原创 2018-03-28 15:01:03 · 153 阅读 · 0 评论 -
POJ 3468 A Simple Problem with Integers
HDU 3468#include<cstdio> using namespace std; long long tree[400010],lazy[400010]; long long build(int node,int l,int r){ if(l==r)scanf("%lld",&tree[node]); else{ int mid=(l+r)/2; tree...原创 2018-03-28 10:59:49 · 115 阅读 · 0 评论 -
POJ 2528
POJ 2528#include<map> #include<cstdio> #include<cstring> #include<algorithm> using namespace std; map<int,int> ky; struct node{ int x,y; }a[80010]; int tre[80010],laz[80...原创 2018-03-28 10:57:56 · 134 阅读 · 0 评论 -
HDU 1394
HDU 1394#include<bits/stdc++.h> using namespace std; int n,i,sum,ans; int val[20010],tree[20010]; int query(int node,int L,int R,int l,int r){ if(l==L&&r==R) return tree[node...原创 2018-03-28 10:53:44 · 204 阅读 · 0 评论 -
HDU 1698
HDU 1698#include<bits/stdc++.h> using namespace std; int tre[400010],laz[400010]; void pushup(int num){ tre[num]=tre[num*2]+tre[num*2+1]; } void pushdown(int num,int le,int ri){ int mid=...原创 2018-03-28 10:51:47 · 134 阅读 · 0 评论 -
HDU 1754
HDU 1754#include<bits/stdc++.h> using namespace std; int a[200010],tree[800100]; int build(int node,int l,int r){ int mid=(l+r)/2; if(r==l) return tree[node]=a[r]; else ...原创 2018-03-28 10:50:30 · 159 阅读 · 0 评论 -
HDU 1166
HDU 1166#include<bits/stdc++.h> using namespace std; int a[50010],tree[200100]; int build(int node,int l,int r){ int mid=(l+r)/2; if(r==l) return tree[node]=a[r]; else ...原创 2018-03-28 10:49:09 · 116 阅读 · 0 评论 -
POJ 2828 Buy Tickets
#include<cstdio> using namespace std; const int M=200010; int pos[M],val[M],point[M],size[M*3]; void build_tree(int node,int l,int r){ size[node]=r-l+1; if(l==r)return; int mid=(l+r)/2; buil...原创 2018-04-05 16:50:11 · 136 阅读 · 0 评论