线段树
纵马且长歌
贪心过样例,暴力出奇迹,骗分最神奇,打表进省一
展开
-
NEFU 1215
#include #include #include #include #define manx 200100 using namespace std; int a[manx]; struct Node{ int l,r;long long val; }seg[manx<<2]; void build(int node,int l,int r) { seg[node].l=原创 2016-12-27 13:29:12 · 312 阅读 · 0 评论 -
hdu2795_Billboard_线段树
Billboard Time Limit: 20000/8000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 21247 Accepted Submission(s): 8773 Problem Description At the entrance to原创 2017-03-30 23:43:30 · 121 阅读 · 0 评论 -
CodeForces 339D Xenia and Bit Operations(线段树)
D. Xenia and Bit Operations time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Xenia the beginner programm原创 2017-04-06 16:49:17 · 320 阅读 · 0 评论 -
hdu4819_Mosaic_二维线段树(及二维线段树的概念的理解)
Mosaic Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/102400 K (Java/Others) Total Submission(s): 1745 Accepted Submission(s): 769 Problem Description The God of sheep deci原创 2017-04-19 20:37:13 · 330 阅读 · 0 评论 -
CDOJ_1591_An easy problem A(线段树水题)
An easy problem A Edit Time Limit: 1000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others) Submit Status N个数排成一列,Q个询问,每次询问一段区间内的数的极差是多少。 Input 第一行两个整数N(1≤N≤500原创 2017-05-16 17:17:10 · 724 阅读 · 0 评论 -
poj3468 A Simple Problem with Integers (线段树的懒惰标记)
题目链接: http://poj.org/problem?id=3468 题意: 对于一个区间的数有两种操作: C a b c 在区间[a,b]内的数全部加上c Q a b 查询区间[a,b]之间的数的和 解: 嗯,没什么好说的,就直接线段树就行了,需要注意的就是懒惰标记的理解和应用了。 关于懒惰标记的理解推荐这篇博客:http://blog.csdn.net/s原创 2017-08-07 16:04:22 · 94 阅读 · 0 评论 -
NEFU OJ 1247 平静的小镇
题目链接:http://acm.nefu.edu.cn/JudgeOnline/problemShow.php?problem_id=1247 解: 线段树的懒惰标记的运用。需要注意的点就是添加超过n时的区间更新。 代码: #include #include #include #include #include #include using namespace std; con原创 2017-11-13 11:51:10 · 243 阅读 · 0 评论 -
hdu6070 Dirt Ratio(二分+线段树)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6070 题意:在区间[l,r]中,不同数的个数/区间长度的最小值 解: 用二分找答案最小值,用size(l,r)/(r-l+1) 公式可以赚话为size(l,r)+l*mid size(l,r)可以实时更新,且可以用数组进行存储。 代码: #include #include #incl原创 2017-08-28 19:11:22 · 287 阅读 · 0 评论