Live2d Test Env

随笔分类 -  RMQ---线段树

摘要:5457: 城市 Description 有n座城市,m个民族。这些城市之间由n-1条道路连接形成了以城市1为根的有根树。每个城市都是某一民族的聚居 地,Master知道第i个城市的民族是A_i,人数是B_i。为了维护稳定,Master需要知道某个区域内人数最多的民族 。他向你提出n个询问,其中第i 阅读全文
posted @ 2018-11-14 22:50 nimphy 阅读(512) 评论(0) 推荐(0)
摘要:5142: [Usaco2017 Dec]Haybale Feast Description Farmer John is preparing a delicious meal for his cows! In his barn, he has NN haybales (1≤N≤100,0 00). 阅读全文
posted @ 2018-11-14 16:03 nimphy 阅读(250) 评论(0) 推荐(0)
摘要:5194: [Usaco2018 Feb]Snow Boots Description 到冬天了,这意味着下雪了!从农舍到牛棚的路上有N块地砖,方便起见编号为1…N,第i块地砖上积了fi英尺的雪 。在Farmer John的农舍的地窖中,总共有B双靴子,编号为1…B。其中某些比另一些结实,某些比另一 阅读全文
posted @ 2018-11-14 15:43 nimphy 阅读(346) 评论(0) 推荐(0)
摘要:Description 给您一颗树,每个节点有个初始值。 现在支持以下两种操作: 1. C i x(0<=x<2^31) 表示将i节点的值改为x。 2. Q i j x(0<=x<2^31) 表示询问i节点到j节点的路径上有多少个值为x的节点。 给您一颗树,每个节点有个初始值。 现在支持以下两种操作 阅读全文
posted @ 2018-11-12 13:43 nimphy 阅读(412) 评论(0) 推荐(0)
摘要:Do you like painting? Little D doesn't like painting, especially messy color paintings. Now Little B is painting. To prevent him from drawing messy pa 阅读全文
posted @ 2018-10-19 20:05 nimphy 阅读(361) 评论(0) 推荐(0)
摘要:题意:给定N个节点,K次操作,操作有两种,1是合并两个集合,2是求某个集合的第K大(从小到大排序)。 思路:合并只要启发式即可。此题可以用线段树,保存1到N的排序的出现次数和。 复杂度O(NlogN)。想象一下,当其中一棵树节点少的时候,复杂度是O(logN)的,次数不超过N次;当两棵树的节点都蛮多 阅读全文
posted @ 2018-09-20 10:12 nimphy 阅读(326) 评论(0) 推荐(0)
摘要:There is a sequence aa of length nn. We use aiai to denote the ii-th element in this sequence. You should do the following three types of operations t 阅读全文
posted @ 2018-09-19 15:28 nimphy 阅读(359) 评论(0) 推荐(0)
摘要:At the children's day, the child came to Picks's house, and messed his house up. Picks was angry at him. A lot of important things were lost, in parti 阅读全文
posted @ 2018-09-19 09:48 nimphy 阅读(329) 评论(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 exactly the hei 阅读全文
posted @ 2018-08-31 21:49 nimphy 阅读(363) 评论(0) 推荐(0)
摘要:One day Natalia was walking in the woods when she met a little mushroom gnome. The gnome told her the following story: Everybody knows that the mushro 阅读全文
posted @ 2018-08-22 22:50 nimphy 阅读(456) 评论(0) 推荐(0)
摘要:I guess there's not much point in reminding you that Nvodsk winters aren't exactly hot. That increased the popularity of the public transport dramatic 阅读全文
posted @ 2018-08-22 15:45 nimphy 阅读(388) 评论(0) 推荐(0)
摘要:Description Input 第一行 :一个整数N ,表示方案和询问的总数。 接下来N行,每行开头一个单词“Query”或“Project”。 若单词为Query,则后接一个整数T,表示Blue Mary询问第T天的最大收益。 若单词为Project,则后接两个实数S,P,表示该种设计方案第一 阅读全文
posted @ 2018-07-05 17:01 nimphy 阅读(233) 评论(0) 推荐(0)
摘要: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 阅读全文
posted @ 2018-03-22 19:12 nimphy 阅读(264) 评论(0) 推荐(0)
摘要:在平面直角坐标系中给定N个圆。已知这些圆两两没有交点,即两圆的关系只存在相离和包含。求这些圆的异或面 积并。异或面积并为:当一片区域在奇数个圆内则计算其面积,当一片区域在偶数个圆内则不考虑。 Input 第一行包含一个正整数N,代表圆的个数。接下来N行,每行3个非负整数x,y,r,表示一个圆心在(x 阅读全文
posted @ 2018-03-22 17:41 nimphy 阅读(536) 评论(0) 推荐(0)
摘要:Rubik is very keen on number permutations. A permutation a with length n is a sequence, consisting of n different numbers from 1 to n. Element number  阅读全文
posted @ 2018-03-17 11:13 nimphy 阅读(482) 评论(0) 推荐(0)
摘要:Sereja has a bracket sequence s1, s2, ..., sn, or, in other words, a string s of length n, consisting of characters "(" and ")". Sereja needs to answe 阅读全文
posted @ 2018-03-13 10:56 nimphy 阅读(504) 评论(0) 推荐(0)
摘要:Pete 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 l 阅读全文
posted @ 2018-03-12 20:59 nimphy 阅读(286) 评论(0) 推荐(0)
摘要:To stay woke and attentive during classes, Karen needs some coffee! Karen, a coffee aficionado, wants to know the optimal temperature for brewing the 阅读全文
posted @ 2018-03-12 19:16 nimphy 阅读(384) 评论(0) 推荐(0)
摘要:Mad scientist Mike has constructed a rooted tree, which consists of n vertices. Each vertex is a reservoir which can be either empty or filled with wa 阅读全文
posted @ 2018-03-12 08:45 nimphy 阅读(260) 评论(0) 推荐(0)
摘要:1,poj 1151 Atlantis: 求矩形面积并。 2,poj 1177 Picture: 求矩形轮廓的周长。 3,poj 1389 Area of Simple Polygons :同第一题。 4,poj 1823 Hotel :线段树线段的插入删除求线段树中最长的线段长度 5,poj 21 阅读全文
posted @ 2018-01-16 12:40 nimphy 阅读(378) 评论(0) 推荐(0)