![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树
YCQ_Lancet
骐骥一跃,不能十步,驽马十驾,功在不舍
展开
-
敌兵布阵 HDU - 1166
C国的死对头A国这段时间正在进行军事演习,所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段,所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动,可能增加或减少若干人手,但这些都逃不过C国的监视。 中央情报局要研究敌人究竟演习什么战术原创 2017-06-20 18:21:59 · 201 阅读 · 0 评论 -
Turing Tree hdu 3333(传说中的图灵树)
Turing Tree Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 5934 Accepted Submission(s): 2118 Problem Description After inventing Tu原创 2017-11-07 21:54:52 · 856 阅读 · 0 评论 -
Vases and Flowers HDU - 4614 线段树变形
Alice有N个花瓶(标号为0~ N-1)。当她收到一些花时,她会随机的选择一个瓶子A,从它开始遍历A,A+1, A+2, ..., N-1号瓶子,遇到空瓶子就放一朵花进去,直到花朵放完或没有瓶子,剩下的花将被丢弃。有时,她也会清理标号从A到B的花瓶(A <= B).花瓶里的花会被丢弃。 Input 第一行一个整数T,表示数据组数。 每组数据,第一行一个整数N(1 是花瓶个数,原创 2017-07-23 21:15:13 · 250 阅读 · 0 评论 -
Just a Hook HDU - 1698 线段树延迟更新
In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length. No原创 2017-07-10 10:07:57 · 281 阅读 · 0 评论 -
Assign the task HDU - 3974 区间更新,单点查询
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原创 2017-07-21 16:01:26 · 346 阅读 · 0 评论 -
Can you answer these queries? HDU - 4027 线段树 区间更新
A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of end原创 2017-07-17 20:44:30 · 359 阅读 · 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原创 2017-07-21 11:00:52 · 294 阅读 · 0 评论 -
Balanced Lineup POJ - 3264
For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things原创 2017-06-21 21:18:15 · 224 阅读 · 0 评论 -
POJ 3468 A Simple Problem with Integers
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原创 2017-06-21 20:28:28 · 301 阅读 · 0 评论 -
小白初识线段树(线段树原理+专题练习)
希望再次遇到线段树的题目时可以AC! 线段树其实就是个二叉树。我们一般用数组来进行模拟(如果用结构体+指针也是可以的)。注意,这个二叉树不一定是个完全二叉树。 问题1.如果当前有个数组是的下表是0-(n-1),即有n个元素,那么需要多那么大数组来存放线段树呢。 其实,他的实际有效的空间是2*n-1个,但是我们如果用数组来进行模拟,父亲节点的两个儿子节点我们是如何表示的? 我们是原创 2017-06-19 18:55:49 · 270 阅读 · 0 评论 -
HDU 1754 I Hate It
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0 学生ID编号分别从1编到N。 第二原创 2017-06-21 19:17:51 · 224 阅读 · 0 评论 -
Mayor's posters POJ - 2528
The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all places at their whim. The city council has finally d原创 2017-07-11 09:29:18 · 450 阅读 · 0 评论 -
Danil and a Part-time Job codeforces dfs序,线段树
Danil and a Part-time Job time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Danil decided to earn some money, so he had f原创 2017-11-01 09:03:34 · 323 阅读 · 0 评论