
线段树
LZH0217
这个作者很懒,什么都没留下…
展开
-
A Simple Problem with Integers POJ - 3468(线段树模板,区间修改,区间查询)
A Simple Problem with IntegersPOJ - 3468code#include <iostream>#include <algorithm>#include <cstdio>#include <cstring>#include <vector>#include <queue>using namespace std;typedef long long ll;const int N = 10原创 2020-09-15 12:10:04 · 113 阅读 · 0 评论 -
HDU-1698 Just a Hook(线段树模板,懒标记区间修改)
HDU-1698 Just a Hook/* * HDU-1698 Just a Hook * http://acm.hdu.edu.cn/showproblem.php?pid=1698 */#include <iostream>#include <algorithm>#include <cstring>#include <vector>#include <queue>using namespace std;const原创 2020-09-14 20:02:49 · 111 阅读 · 0 评论 -
I Hate It POJ - 1754(线段树 模板)
I Hate Ithttp://acm.hdu.edu.cn/showproblem.php?pid=1754线段树区间最大值,单点修改,区间查询。code#include <iostream>#include <algorithm>#include <cstring>using namespace std;const int N = 200005;int tree[N << 2];#define ls(x) (x <<原创 2020-09-13 20:59:00 · 134 阅读 · 0 评论 -
敌兵布阵 HDU-1166(线段树 单点修改 区间查询)
/** 敌兵布阵 HDU-1166 线段树-单点修改-区间查询-敌兵布阵HDU-1166 */#include <iostream>#include <string>#define N 50005using namespace std;int n;int sum[N << 2];void push_up(int root) { sum[root] = sum[root << 1] + sum[root << 1 |原创 2020-09-13 10:04:07 · 151 阅读 · 0 评论 -
A Simple Problem with Integers POJ - 3468(线段树 区间修改 区间查询)
//A Simple Problem with Integers POJ - 3468//线段树-区间修改-区间查询#include <cstdio>#define N 100010typedef long long ll;ll sum[N << 2];ll lazy[N << 2];ll x;void push_up(int root) { sum[root] = sum[root << 1] + sum[root <<原创 2020-09-13 10:02:37 · 113 阅读 · 0 评论 -
小A盗墓 upc(线段树)
/*upc问题 E: 小A盗墓时间限制: 5 Sec 内存限制: 128 MB题目描述小A终于通过了保安的考验,来到了古墓门前,古墓门前有n根柱子,第i根柱子的高度是整数。古墓的门上会弹出一些暗号,机智小A猜到这个暗号表示询问第l到第r根柱子的高度在升序排序后是否构成一段连续且上升的序列。并且这些柱子的高度还可能在弹出暗号的过程中出现变化。现在小A需要回答出每个暗号的答案输入第一行两个整数,表示柱子的个数n以及操作的个数m。第二行n个整数,第i个整数表示第i根柱子的高度。接下来原创 2020-09-13 10:01:03 · 116 阅读 · 0 评论 -
POJ 1151 Atlantis(扫描线)
POJ 1151 AtlantisDescriptionThere are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describe different regions of Atlantis.原创 2020-05-23 08:52:54 · 244 阅读 · 0 评论 -
洛谷 P5490【模板】扫描线
洛谷 P5490【模板】扫描线题目链接题目描述求 nnn 个矩形的面积并。输入格式第一行一个正整数 nnn。接下来 nnn 行每行四个非负整数 x1,y1,x2,y2x_1, y_1, x_2, y_2x1,y1,x2,y2,表示一个矩形的左下角坐标为 (x1,y1)(x_1, y_1)(x1,y1),右上角标为 (x2,y2)(x_2, y_2)(x2,y2)。输出格式一行一个正整数,表示 nnn 个矩形的并集覆盖的总面积。输入输出样例输入 #12100 100 2原创 2020-05-23 08:50:14 · 289 阅读 · 0 评论 -
HDU1255覆盖的面积(扫描线)
文章目录扫描线&覆盖的面积Problem DescriptionInputOutputSample InputSample OutputAC代码扫描线&覆盖的面积Problem Description给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积.Input输入数据的第一行是一个正整数T(1<=T<=100),代表测试数据的数量.每个测试数据的第...原创 2020-02-01 13:23:31 · 286 阅读 · 0 评论 -
智乃与无意义的题目(西工大校赛 线段树)
智乃与无意义的题目哇!一看就是智乃姐姐出的题????题目链接2020年西北工业大学“编程之星”程序设计挑战赛(大学生程序设计创新实践基地队员春季选拔赛)分析:看到修改和查询想到的就是线段树,但是要用线段树维护什么东西还得继续分析。f(n)=∑i∣n1f(n)=\sum_{i|n}1f(n)=∑i∣n1 是 nnn 的因子个数,求一个数的因子个数我们可以想到与唯一分解定理有关的一个公式:...原创 2020-05-02 13:23:16 · 990 阅读 · 0 评论