随笔分类 -  线段树

摘要:Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 270 Accepted Submission(s... 阅读全文
posted @ 2016-09-19 14:41 Herumw 阅读(162) 评论(0) 推荐(0)
摘要:Description给出一个n个节点的有根树(编号为0到n-1,根节点为0)。一个点的深度定义为这个节点到根的距离+1。设dep[i]表示点i的深度,LCA(i,j)表示i与j的最近公共祖先。有q次询问,每次询问给出l r z,求sigma_{l#include#i... 阅读全文
posted @ 2016-04-25 15:34 Herumw 阅读(146) 评论(0) 推荐(0)
摘要:Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成颜色c;2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“112221”由3段组成:“11”、“222”和“1”。请你写一个程序依次... 阅读全文
posted @ 2016-04-20 16:41 Herumw 阅读(121) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2016-04-20 11:04 Herumw 阅读(202) 评论(0) 推荐(0)
摘要:Problem DescriptionBackgroundTo The Moon is a independent game released in November 2011, it is a role-playing adventure game powered ... 阅读全文
posted @ 2016-04-11 20:15 Herumw 阅读(183) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2016-03-29 14:05 Herumw 阅读(212) 评论(0) 推荐(0)
摘要:DescriptionMirko is hungry as a bear, scratch that, programmer and has stumbled upon a local restaurant. The restaurant offers N meals... 阅读全文
posted @ 2016-03-21 16:37 Herumw 阅读(122) 评论(0) 推荐(0)
摘要:Problem DescriptionIn order to remember history, King plans to play losephus problem in the parade gap.He calls n(1≤n≤5000) soldiers, ... 阅读全文
posted @ 2016-03-17 13:45 Herumw 阅读(179) 评论(0) 推荐(0)
摘要:Description"Hey! I have an awesome task with chameleons, 5 th task for Saturday’s competition.""Go ahead. . . "(...)“That’s too diffic... 阅读全文
posted @ 2016-03-08 18:58 Herumw 阅读(185) 评论(0) 推荐(0)
摘要:题目链接:http://codeforces.com/gym/100803/attachments/download/3816/20142015-acmicpc-asia-tokyo-regional-contest-en.pdf题意:给你一些匹配好的括号,长为n,有... 阅读全文
posted @ 2015-11-08 21:29 Herumw 阅读(108) 评论(0) 推荐(0)
摘要:Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 2346 Accepted Submission(s)... 阅读全文
posted @ 2015-09-30 18:53 Herumw 阅读(228) 评论(0) 推荐(0)
摘要:Time Limit: 3 Seconds Memory Limit: 32768 KBNow the God is very angry, so he wants to punish the lazy, greedy humans. He chooses ... 阅读全文
posted @ 2015-08-06 11:39 Herumw 阅读(151) 评论(0) 推荐(0)
摘要:Problem Description 因为马拉松初赛中吃鸡腿的题目让不少人抱憾而归,威威猫一直觉得愧对大家,这几天他悄悄搬到直角坐标系里去住了。 生活还要继续,太阳也照常升起,今天,威威猫在第一象限晒了N条矩形的被子,被子的每条边都和坐标轴平行,不同被子的某些部... 阅读全文
posted @ 2015-08-04 20:22 Herumw 阅读(266) 评论(0) 推荐(0)
摘要:time limit per test4 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe Little Elephant loves playin... 阅读全文
posted @ 2015-07-29 11:52 Herumw 阅读(177) 评论(0) 推荐(0)
摘要:time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputDrazil is a monkey. He lives in ... 阅读全文
posted @ 2015-07-28 21:11 Herumw 阅读(112) 评论(0) 推荐(0)
摘要:Rip Van Winkle was fed up with everything except programming. One day he found a problem whichrequired to perform three types of updat... 阅读全文
posted @ 2015-07-26 20:38 Herumw 阅读(127) 评论(0) 推荐(0)
摘要:DescriptionPete and Bob invented a new interesting game. Bob takes a sheet of paper and locates a Cartesian coordinate system on it as... 阅读全文
posted @ 2015-07-21 20:58 Herumw 阅读(150) 评论(0) 推荐(0)
摘要:DescriptionIn this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integ... 阅读全文
posted @ 2015-06-03 14:23 Herumw 阅读(103) 评论(0) 推荐(0)
摘要: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... 阅读全文
posted @ 2015-05-31 11:11 Herumw 阅读(152) 评论(0) 推荐(0)
摘要:Problem DescriptionData structure is one of the basic skills for Computer Science students, which is a particular way of storing and o... 阅读全文
posted @ 2015-05-31 09:48 Herumw 阅读(165) 评论(0) 推荐(0)