随笔分类 -  07.数据结构 - (03)线段树 & 树状数组

摘要:题目链接:https://www.luogu.org/problemnew/show/P3373 题目描述 如题,已知一个数列,你需要进行下面三种操作: 1.将某区间每一个数乘上x 2.将某区间每一个数加上x 3.求出某区间每一个数的和 输入格式: 第一行包含三个整数N、M、P,分别表示该数列数字的 阅读全文
posted @ 2018-08-09 00:39 Dilthey 阅读(309) 评论(0) 推荐(0)
摘要:题目链接:https://www.nowcoder.com/acm/contest/143/F 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/ 阅读全文
posted @ 2018-08-05 01:10 Dilthey 阅读(476) 评论(0) 推荐(0)
摘要:题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=6318 Problem Description Long long ago, there was an integer sequence a.Tonyfang think this sequence is 阅读全文
posted @ 2018-07-26 02:44 Dilthey 阅读(355) 评论(0) 推荐(0)
摘要:题目链接:https://www.nowcoder.com/acm/contest/140/J 时间限制:C/C++ 4秒,其他语言8秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 时间限制:C/C++ 4秒,其他语言8秒 空间限制:C/ 阅读全文
posted @ 2018-07-26 00:51 Dilthey 阅读(384) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6278 Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others) Problem Descrip 阅读全文
posted @ 2018-06-27 20:44 Dilthey 阅读(303) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/problemset/problem/838/B You are given a directed weighted graph with n nodes and 2n - 2 edges. The nodes are labeled from  阅读全文
posted @ 2018-05-07 21:38 Dilthey 阅读(445) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5692 Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Descript 阅读全文
posted @ 2018-05-04 10:34 Dilthey 阅读(309) 评论(0) 推荐(1)
摘要:题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1809 Bobo has a balanced parenthesis sequence P=p 1 p 2…p n of length n and q questions. The i 阅读全文
posted @ 2018-05-03 20:52 Dilthey 阅读(590) 评论(0) 推荐(0)
摘要:题目链接:https://hihocoder.com/problemset/problem/1305 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定两个区间集合 A 和 B,其中集合 A 包含 阅读全文
posted @ 2017-10-16 22:37 Dilthey 阅读(254) 评论(0) 推荐(0)
摘要:题还是那个题:http://www.cnblogs.com/dilthey/p/6827959.html 不过我们今天换一种线段树实现来做这道题; 关于zkw线段树的讲解:https://zhuanlan.zhihu.com/p/29876526(而且我还在文章里被@了,超开心的ヾ(≧∇≦*)ヾ) 阅读全文
posted @ 2017-10-07 23:25 Dilthey 阅读(268) 评论(0) 推荐(0)
摘要:题目链接:https://cn.vjudge.net/problem/UVALive-3938 参考刘汝佳书上说的: 题意: 给出一个长度为n的序列, 再给出m个询问, 每个询问是在序列 $[a,b]$ 之间的最大连续和. 要你计算出这个这个区间内最大连续和的区间 $[x,y](a \le x \l 阅读全文
posted @ 2017-09-07 22:32 Dilthey 阅读(347) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=2528 Time Limit: 1000MS Memory Limit: 65536K Description The citizens of Bytetown, AB, could not stand that the candida 阅读全文
posted @ 2017-09-06 15:27 Dilthey 阅读(400) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1754 Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Problem Descripti 阅读全文
posted @ 2017-09-05 23:20 Dilthey 阅读(239) 评论(0) 推荐(0)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Problem Descripti 阅读全文
posted @ 2017-05-08 21:32 Dilthey 阅读(340) 评论(0) 推荐(0)
摘要:题目链接:http://acm.uestc.edu.cn/#/problem/show/1059 Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) 秋实大哥以周济天下,锄强扶弱为己任,他常对 阅读全文
posted @ 2017-05-08 19:44 Dilthey 阅读(240) 评论(0) 推荐(0)
摘要:题目链接:http://acm.uestc.edu.cn/#/problem/show/1057 线段树的第一题,看着题解和讲解,自己把模板一点点慢慢码出来的。 线段树讲解:http://www.cnblogs.com/TenosDoIt/p/3453089.html 2018-5-1更新 今天又看 阅读全文
posted @ 2017-05-08 14:20 Dilthey 阅读(309) 评论(0) 推荐(0)
摘要:题目链接:http://poj.org/problem?id=3928 树状数组的应用。 把每个人当做裁判进行遍历,计算住在这个人之前的人中有多少个是比他弱的,记为pre_less[i],多少个人比他强的记为pre_more[i];同样的,住在他后面的人中,比他弱的记为suf_less[i],比他强 阅读全文
posted @ 2017-04-27 19:33 Dilthey 阅读(217) 评论(0) 推荐(0)
摘要:Time Limit: 1000MS Memory Limit: 65536K Description Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. J 阅读全文
posted @ 2017-04-25 20:34 Dilthey 阅读(317) 评论(0) 推荐(0)
摘要:思路来自http://blog.csdn.net/Courage_kn/article/details/69218592 用#define比定义一个lowbit函数快……不过好像很多时候不能像函数那样随便用,容易出问题…… 这是分别用 long long lowbit(long long x){re 阅读全文
posted @ 2017-04-24 21:27 Dilthey 阅读(260) 评论(0) 推荐(0)