线段树
线段树
七九河开
这个作者很懒,什么都没留下…
展开
-
效率至上 OJ
效率至上Time Limit: 5000MS Memory Limit: 65536KB Problem Description题意很简单,给出一个数目为n的非有序序列,然后有m次查询.对于每次查询输入两个正整数l,r请输出区间[l,r]的最大值与最小值的差值Input 第一行:输入两个正整数n,m (1;第二行:输入n个整数 大小范围为[1,100000]原创 2018-01-26 14:25:44 · 361 阅读 · 0 评论 -
Party HDU - 6521 (吉司机线段树)
题目https://cn.vjudge.net/problem/HDU-6521题意给你n个人 m个聚会 告诉你每个聚会有哪些人参加 问这些人能组成多少对不同的新朋友 之前组成过朋友不再计算思路吉司机线段树 记录当前区间已经和哪些组过,查询时如果组过的大于查询的就不再查询 不然就遍历每个没组过的点,统计个数#include <bits/stdc++.h>u...原创 2019-05-04 09:33:07 · 147 阅读 · 0 评论 -
Tree POJ - 3237 (树链剖分)
题目 https://cn.vjudge.net/problem/POJ-3237难点是线段树#include <iostream>#include <algorithm>#include <cstdio>#include <cstdlib>#include <cstring>using namespace std;...原创 2019-01-18 11:12:42 · 159 阅读 · 0 评论 -
Aragorn's Story HDU - 3966 (树链剖分 + 模板)
题目 https://cn.vjudge.net/problem/HDU-3966Fish_Li https://li-fish.github.io/2017/08/09/cjqx554pg002d4kc24xybxqqi/树链剖分 https://www.cnblogs.com/George1994/p/7821357.html题意裸地树链剖分思路模板题#inclu...原创 2019-01-17 15:03:39 · 183 阅读 · 0 评论 -
Atlantis HDU - 1542 (扫描线 + 线段树)
https://cn.vjudge.net/problem/HDU-1542题意求矩形覆盖的面积思路模板题#include <bits/stdc++.h>using namespace std;const int maxn = 210;int n,cnt,num,p;double ls[maxn*2],ans;struct edg ///边{ ...原创 2018-12-06 15:41:02 · 192 阅读 · 0 评论 -
Tourism on Mars URAL - 2109 (LCA,线段树)
LCA博客 https://blog.csdn.net/sdut_jk17_zhangming/article/details/84592285 Few people know, but a long time ago a developed state existed on Mars. It consisted of n cities, numbered by integers ...原创 2018-11-28 21:45:05 · 159 阅读 · 0 评论 -
Colonial Mansions Gym - 101962I (线段树+二分)
After a year of hard work, Mano finally had a month off. He decided to take his grandmother to Soteropolis during this time. As soon as they arrived at the airport, Mano bought one of these "10 things...原创 2018-11-02 15:24:45 · 319 阅读 · 0 评论 -
Assign the task HDU - 3974 (dfs序+线段树)
There is a company that has N employees(numbered from 1 to N),every employee in the company has a immediate boss (except for the leader of whole company).If you are the immediate boss of someone,that ...原创 2018-10-19 20:37:37 · 188 阅读 · 0 评论 -
Tunnel Warfare HDU - 1540
During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except t...原创 2018-10-19 19:22:08 · 162 阅读 · 0 评论 -
敌兵布阵 HDU - 1166
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术,所...原创 2018-08-02 21:12:45 · 114 阅读 · 0 评论 -
Simple Problem with Integers POJ - 3468
You have N integers, A1, A2, ... , AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the ...原创 2018-08-02 21:10:16 · 92 阅读 · 0 评论 -
线段树模板总结
大牛博客 https://blog.csdn.net/zearot/article/details/48299459#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#include <vector>#include <...原创 2018-08-02 21:09:05 · 110 阅读 · 0 评论 -
迷之好奇 oj
迷之好奇Time Limit: 2000MS Memory Limit: 65536KBProblem DescriptionFF得到了一个有n个数字的集合。不要问我为什么,有钱,任性。FF很好奇的想知道,对于数字x,集合中有多少个数字可以在x前面添加任意数字得到。如,x = 123,则在x前面添加数字可以得到4123,5123等。Input原创 2018-01-30 08:12:49 · 193 阅读 · 0 评论 -
数组计算机 oj
数组计算机Time Limit: 1000MS Memory Limit: 65536KBProblem DescriptionbLue 有一个神器的机器,这个机器可以读入一个数组,并按照用户要求快速地进行数组的处理和计算,它支持如下两种操作:操作 1:把数组中第 p 个元素的值增加 v。操作 2:计算数组中 [l, r] 区间内所有数的和。这个机器就是这么的神原创 2018-01-26 14:48:40 · 465 阅读 · 0 评论 -
Legacy CodeForces - 786B (线段树优化建边+)
题目https://cn.vjudge.net/problem/CodeForces-786B题意最短路思路建两棵树 入树和出树 入树每个结点向孩子建边 出树向父亲建边 每棵树的叶子结点不能相互到达 只能通过新建的边到达 即最短路#include <bits/stdc++.h>using namespace std;typedef long long ...原创 2019-05-06 16:20:38 · 261 阅读 · 0 评论