
线段树
jiang_16
一个想学好编程的弱渣妹纸,猎奇,脑洞向...
展开
-
数组计算机 单点更新和区间查询
bLue 有一个神器的机器,这个机器可以读入一个数组,并按照用户要求快速地进行数组的处理和计算,它支持如下两种操作:操作 1:把数组中第 p 个元素的值增加 v。操作 2:计算数组中 [l, r] 区间内所有数的和。这个机器就是这么的神奇,但是 bLue 的计算机坏掉了,你能帮他修一下吗?Input输入数据有多组(数据组数不超过 20),到 EOF 结束。对于每组数原创 2017-09-08 23:05:44 · 227 阅读 · 0 评论 -
Count the Colors 染色
Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones.Your task is counting the segments of different colors you can see at last.I原创 2017-09-17 16:48:58 · 161 阅读 · 0 评论 -
Mayor's posters 离散化+线段树染色
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-09-17 16:40:52 · 191 阅读 · 0 评论 -
Can you answer these queries? 区间更新和查询
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-09-17 22:04:03 · 191 阅读 · 0 评论 -
I Hate It 单点修改和区间查询
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0学生ID编号分别从1编到N。 第二原创 2017-09-09 23:52:25 · 196 阅读 · 0 评论 -
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-09-10 21:53:16 · 209 阅读 · 0 评论 -
效率至上 区间最值
题意很简单,给出一个数目为n的非有序序列,然后有m次查询.对于每次查询输入两个正整数l,r请输出区间[l,r]的最大值与最小值的差值Input 第一行:输入两个正整数n,m (1;第二行:输入n个整数 大小范围为[1,100000];接下来的m行,每次两个正整数l,r (1Output 输出区间[l,r]最大值与最小值的差值.Example In原创 2017-09-09 11:24:58 · 393 阅读 · 0 评论