
线段树
Kirito_Acmer
这个作者很懒,什么都没留下…
展开
-
codeforces #345 (Div. 1) D. Zip-line (线段树+最长上升子序列)
Vasya has decided to build a zip-line on trees of a nearby forest. He wants the line to be as long as possible but he doesn't remember exactly the heights of all trees in the forest. He is sure that h原创 2016-03-29 14:05:25 · 984 阅读 · 0 评论 -
Codeforces Round #136 (Div. 1) B. Little Elephant and Array
time limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Little Elephant loves playing with arrays. He has array a, c原创 2015-07-29 11:52:26 · 824 阅读 · 0 评论 -
Codeforces Round #292 (Div. 1) C. Drazil and Park
time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputDrazil is a monkey. He lives in a circular park. There are n tre原创 2015-07-28 21:11:14 · 1177 阅读 · 0 评论 -
poj 3468A Simple Problem with Integers
DescriptionYou 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原创 2015-04-01 11:40:49 · 537 阅读 · 0 评论 -
codeforces 292E. Copying Data
We often have to copy large volumes of information. Such operation can take up many computer resources. Therefore, in this problem you are advised to come up with a way to copy some part of a number a原创 2015-04-28 15:21:04 · 1021 阅读 · 0 评论 -
hdu3397 Sequence operation
Problem Descriptionlxhgww got a sequence contains n characters which are all '0's or '1's.We have five operations here:Change operations:0 a b change all characters into '0's in [a , b]1 a原创 2015-05-30 14:56:33 · 705 阅读 · 0 评论 -
poj2299 Ultra-QuickSort
DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the seque原创 2015-06-03 14:23:12 · 837 阅读 · 0 评论 -
Gym 100803G Flipping Parentheses
题目链接:http://codeforces.com/gym/100803/attachments/download/3816/20142015-acmicpc-asia-tokyo-regional-contest-en.pdf题意:给你一些匹配好的括号,长为n,有m个操作,每次操作把其中一个"("改为")",或者把其中一个")"改为"(",问你改动一个单括号,使得改后的括号序列任然完美匹配原创 2015-11-08 21:28:49 · 726 阅读 · 0 评论 -
hdu5643 King's Game(约瑟夫环+线段树)
Problem DescriptionIn order to remember history, King plans to play losephus problem in the parade gap.He calls n(1≤n≤5000) soldiers, counterclockwise in a circle, in label 1,2,3...n.The fir原创 2016-03-17 13:45:29 · 837 阅读 · 3 评论 -
hdu4521 小明系列问题——小明序列
Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2346 Accepted Submission(s): 734Problem Description 大家都知道小明最喜欢研究跟序列有关的问题了,可是也就原创 2015-09-30 18:52:44 · 712 阅读 · 0 评论 -
zjnu1716 NEKAMELEONI (线段树)
Description"Hey! I have an awesome task with chameleons, 5 th task for Saturday’s competition.""Go ahead. . . "(...)“That’s too difficult, I have an easier one, they won’t even原创 2016-03-08 18:58:09 · 577 阅读 · 0 评论 -
hdu5893 List wants to travel(树链剖分+线段树)
Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 270 Accepted Submission(s): 47Problem DescriptionA boy named List who is perf原创 2016-09-19 14:40:32 · 898 阅读 · 0 评论 -
hdu3530 Subsequence
Problem DescriptionThere is a sequence of integers. Your task is to find the longest subsequence that satisfies the following condition: the difference between the maximum element and the minimum原创 2015-05-16 11:08:40 · 1163 阅读 · 2 评论 -
bzoj2243 [SDOI2011]染色 (树链剖分+线段树)
Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成颜色c;2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“112221”由3段组成:“11”、“222”和“1”。请你写一个程序依次完成这m个操作。Input第一行包含2个整数n和m,分别表示节点原创 2016-04-20 16:41:14 · 1512 阅读 · 0 评论 -
SPOJ QTREE- Query on a tree (树链剖分)
You are given a tree (an acyclic undirected connected graph) with N nodes, and edges numbered 1, 2, 3...N-1.We will ask you to perfrom some instructions of the following form:CHANGE i ti : cha原创 2016-04-20 11:03:30 · 433 阅读 · 0 评论 -
hdu4348 To the moon (主席树 || 离线线段树)
Problem DescriptionBackgroundTo The Moon is a independent game released in November 2011, it is a role-playing adventure game powered by RPG Maker.The premise of To The Moon is based around a原创 2016-04-11 20:14:42 · 1040 阅读 · 0 评论 -
bzoj3626: [LNOI2014]LCA (树链剖分+离线线段树)
Description给出一个n个节点的有根树(编号为0到n-1,根节点为0)。一个点的深度定义为这个节点到根的距离+1。设dep[i]表示点i的深度,LCA(i,j)表示i与j的最近公共祖先。有q次询问,每次询问给出l r z,求sigma_{l(即,求在[l,r]区间内的每个节点i与z的最近公共祖先的深度之和)Input第一行2个整数n q。接下来n原创 2016-04-25 15:33:44 · 652 阅读 · 0 评论 -
Uva 12436 Rip Van Winkle's Code
Rip Van Winkle was fed up with everything except programming. One day he found a problem whichrequired to perform three types of update operations (A, B, C), and one query operation S over an arraydat原创 2015-07-26 20:37:54 · 1087 阅读 · 0 评论 -
zjnu1762 U (线段树)
DescriptionMirko is hungry as a bear, scratch that, programmer and has stumbled upon a local restaurant. The restaurant offers N meals and has an interesting pricing policy: each meal i has two原创 2016-03-21 16:37:11 · 554 阅读 · 0 评论 -
zoj3299 Fall the Brick
Time Limit: 3 Seconds Memory Limit: 32768 KBNow the God is very angry, so he wants to punish the lazy, greedy humans. He chooses to throw some lines of bricks (just down from the very high Heav原创 2015-08-06 11:39:09 · 743 阅读 · 0 评论 -
hdu1542 Atlantis
Problem DescriptionThere 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, t原创 2015-05-22 16:13:19 · 794 阅读 · 0 评论 -
Codeforces Beta Round #19 D. Points
DescriptionPete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as follows: point (0, 0) is located in the bottom-left corner,原创 2015-07-21 20:58:13 · 900 阅读 · 0 评论 -
poj1436 Horizontally Visible Segments
DescriptionThere is a number of disjoint vertical line segments in the plane. We say that two segments are horizontally visible if they can be connected by a horizontal line segment that does not原创 2015-05-26 17:58:13 · 698 阅读 · 0 评论 -
hdu3308 LCIS
Problem DescriptionGiven n integers.You have two operations:U A B: replace the Ath number by B. (index counting from 0)Q A B: output the length of the longest consecutive increasing subseque原创 2015-05-26 21:30:57 · 756 阅读 · 0 评论 -
poj3667 Hotel
DescriptionThe cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessie, ever the competent travel agent, ha原创 2015-05-20 13:40:41 · 619 阅读 · 0 评论 -
poj2777 Count Color
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 37779 Accepted: 11355DescriptionChosen Problem Solving and Program design as an optional course, you are required原创 2015-04-27 20:08:38 · 625 阅读 · 0 评论 -
Who Gets the Most Candies?
Time Limit: 5000MS Memory Limit: 131072KTotal Submissions: 11303 Accepted: 3520Case Time Limit: 2000MSDescriptionN children are sitting in a circle to play a game.T原创 2015-04-27 13:21:51 · 857 阅读 · 0 评论 -
poj3264 Balanced Lineup
Time Limit: 5000MS Memory Limit: 65536KTotal Submissions: 37683 Accepted: 17656Case Time Limit: 2000MSDescriptionFor the daily milking, Farmer John's N cows (1 ≤ N ≤原创 2015-04-29 15:55:13 · 676 阅读 · 0 评论 -
poj 2828 Buy Tickets
DescriptionRailway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queue…The Lunar New Year was approaching, but unluckily the Little Ca原创 2015-04-26 18:21:34 · 495 阅读 · 0 评论 -
hdu1698 Just a Hook
Problem DescriptionIn 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原创 2015-03-30 19:50:04 · 636 阅读 · 0 评论 -
hdu3564 Another LIS
Problem DescriptionThere is a sequence firstly empty. We begin to add number from 1 to N to the sequence, and every time we just add a single number to the sequence at a specific position. Now, we w原创 2015-05-28 12:42:26 · 862 阅读 · 0 评论 -
Tunnel Warfare
Problem DescriptionDuring 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原创 2015-05-28 20:58:58 · 745 阅读 · 0 评论 -
hdu3577 Fast Arrangement
Problem DescriptionChinese always have the railway tickets problem because of its' huge amount of passangers and stations. Now goverment need you to develop a new tickets query system.One train原创 2015-05-29 12:44:47 · 1158 阅读 · 0 评论 -
hdu4533 威威猫系列故事——晒被子
Problem Description 因为马拉松初赛中吃鸡腿的题目让不少人抱憾而归,威威猫一直觉得愧对大家,这几天他悄悄搬到直角坐标系里去住了。 生活还要继续,太阳也照常升起,今天,威威猫在第一象限晒了N条矩形的被子,被子的每条边都和坐标轴平行,不同被子的某些部分可能会叠在一起。这时候,在原点处突然发了场洪水,时间t的时候,洪水会蔓延到( t, t ),即左下角为( 0, 0 )原创 2015-08-04 20:21:36 · 1179 阅读 · 1 评论 -
hdu1541 Stars
Problem DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars t原创 2015-05-29 10:03:11 · 679 阅读 · 0 评论 -
poj2528 Mayor's posters
Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 47849 Accepted: 13894DescriptionThe citizens of Bytetown, AB, could not stand that the candidates in the mayoral e原创 2015-05-26 12:32:44 · 633 阅读 · 0 评论 -
hdu1828 Picture
Problem DescriptionA number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Each rectangle can be partial原创 2015-05-25 15:20:42 · 1363 阅读 · 0 评论 -
hdu4339 Query
Problem DescriptionYou are given two strings s1[0..l1], s2[0..l2] and Q - number of queries.Your task is to answer next queries: 1) 1 a i c - you should set i-th character in a-th string to c原创 2015-05-31 11:10:56 · 729 阅读 · 0 评论 -
hdu4325 Flowers
Problem DescriptionAs is known to all, the blooming time and duration varies between different kinds of flowers. Now there is a garden planted full of flowers. The gardener wants to know how many原创 2015-05-30 17:35:21 · 771 阅读 · 0 评论 -
hdu4027 Can you answer these queries?
Problem DescriptionA 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原创 2015-05-29 19:28:37 · 1317 阅读 · 0 评论