线段树
KIDGINBROOK
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
hdu 1394 Minimum Inversion Number 线段树
代码出自http://www.notonlysuccess.com/index.php/segment-tree-complete/ #include #include using namespace std; #define lson l , m , rt << 1 #define rson m + 1 , r , rt << 1 | 1 const int maxn = 5555; in转载 2014-02-01 23:00:58 · 509 阅读 · 0 评论 -
hdu 1540 Tunnel Warfare 线段树
Tunnel Warfare Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 15090Accepted Submission(s): 5957 Problem Description During the War of...原创 2019-04-23 16:27:13 · 234 阅读 · 0 评论 -
hdu 1542 Atlantis 扫描线 矩形面积并
Atlantis Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20693Accepted Submission(s): 8258 Problem Description There are several ancie...原创 2019-03-13 16:50:40 · 385 阅读 · 0 评论 -
uva 11525 Permutation 线段树
题目大意:给定n和k,输出1-k的所有置换按照字典序排列后的第n个置换,其中n由k个数Si给定 当i等于1的时候(k - 1)!就是后面k-1个数所有的置换的个数,然后前面乘si,所以第n个置换的第一个数字即si + 1,同理,可发现其实就是每次求第k大,然后删去该数字。 #include <cstdio> #include <algorithm> #includ...原创 2019-03-01 20:18:55 · 385 阅读 · 0 评论 -
codeforces 1107g Vasya and Maximum Profit 线段树 单调栈
G. Vasya and Maximum Profit time limit per test 3.5 seconds memory limit per test 256 megabytes input standard input output standard output Vasya got really tired of these credits (from probl...原创 2019-02-07 20:33:44 · 379 阅读 · 0 评论 -
codeforces 786B Legacy 线段树建图最短路
B. Legacy time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Rick and his co-workers have made a new radioactive formula and a lot o...原创 2018-11-01 19:38:13 · 531 阅读 · 0 评论 -
poj 3667 Hotel 线段树
题意:1 a:询问是不是有连续长度为a的空房间,有的话住进最左边 2 a b:将[a,a+b-1]的房间清空 思路:记录区间中最长的空房间 线段树操作:update:区间替换 query:询问满足条件的最左断点原创 2014-04-26 14:53:39 · 499 阅读 · 0 评论 -
hdu 2828 Buy Tickets 线段树
最后的人的位置一定是固定的,所以倒序插入原创 2014-05-17 18:49:43 · 654 阅读 · 0 评论 -
hdu Data Structure? 线段树
因为是1到n,原创 2014-05-15 16:47:49 · 586 阅读 · 0 评论 -
hdu 4027 Can you answer these queries? 线段树
注意到当一个数开方到1后就不再变了,每个数开方次数不会太多,所以进行更新时如果该区间的数字都是1了就直接return #include #include #include #define maxn 100100 __int64 sum[4*maxn]; void build(int l,int r,int o) { if(l==r) { scanf("%I6原创 2014-04-16 16:44:56 · 494 阅读 · 0 评论 -
hdu 2795 Billboard 线段树
以高为数轴,维护每个区间的剩余最大值,用线段树二分做 #include #define maxn 200100 int Max[4*maxn]; int h,w,n; int max(int a,int b) { if(a>b) return a; else return b; } void build(int l,int r,int o) { Max[o]=w;原创 2014-03-09 17:06:51 · 504 阅读 · 0 评论 -
hdu 1698 Just a Hook 线段树
线段树的区间修改 #include #define maxn 100100 int set[4*maxn],sum[4*maxn]; void push(int o,int m) { if(set[o]) { set[2*o]=set[2*o+1]=set[o]; sum[2*o]=(m-(m/2))*set[o]; sum[2*o+1]=(m/2)*原创 2014-03-08 15:53:59 · 519 阅读 · 0 评论 -
poj 3468 A Simple Problem with Integers 线段树
线段树的区间加减数,区间查询 #include #include using namespace std; #define LL __int64 const int maxn = 100100; LL sum[4*maxn]; LL add[4*maxn]; void build(int l,int r,int o) { add[o]=0; if(l==r) {原创 2014-03-11 13:35:43 · 559 阅读 · 0 评论 -
hdu 1754 I Hate It 线段树
#include #include #define N 200200 int max[4*N]; int n,m; int A,B; int L,R; int MAX(int a,int b) { if(a>b) return a; else return b; } int MIN(int a,int b) { if(a<b) return a; else return b; } v原创 2013-12-23 00:24:32 · 540 阅读 · 0 评论 -
hdu 2665 Kth number 主席树
Kth number Time Limit: 15000/5000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 12712Accepted Submission(s): 3871 Problem Description Give you a...原创 2017-09-25 17:20:20 · 463 阅读 · 0 评论
分享