随笔分类 -  数据结构 - 线段树

摘要:Recently, TeaTree acquire new knoledge gcd (Greatest Common Divisor), now she want to test you. As we know, TeaTree is a tree and her root is node 1, 阅读全文
posted @ 2018-09-30 23:30 楼主好菜啊 阅读(166) 评论(0) 推荐(0) 编辑
摘要:A . After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a Nogaku show during the feast. To enjoy the sh 阅读全文
posted @ 2018-09-10 20:05 楼主好菜啊 阅读(346) 评论(0) 推荐(0) 编辑
摘要:B. Feeling hungry, a cute hamster decides to order some take-away food (like fried chicken for only 303030 Yuan). However, his owner CXY thinks that t 阅读全文
posted @ 2018-09-05 20:53 楼主好菜啊 阅读(527) 评论(0) 推荐(0) 编辑
摘要:The Power Cube is used as a stash of Exotic Power. There are n cities numbered 1,2,…,n where allowed to trade it. The trading price of the Power Cube 阅读全文
posted @ 2018-08-27 17:05 楼主好菜啊 阅读(744) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.nowcoder.com/acm/contest/160/D来源:牛客网题目描述给出一个长度为n的整数序列a1,a2,...,an,进行m次操作,操作分为两类。操作1:给出l,r,v,将al,al+1,...,ar分别加上v;操作2:给出l,r,询问输入描述:第一行一个 阅读全文
posted @ 2018-08-18 15:40 楼主好菜啊 阅读(295) 评论(0) 推荐(0) 编辑
摘要:链接:https://www.nowcoder.com/acm/contest/105/H来源:牛客网 题目描述 n个桶按顺序排列,我们用1~n给桶标号。有两种操作: 1 l r c 区间[l,r]中的每个桶中都放入一个颜色为c的球 (1≤l,r ≤n,l≤r,0≤c≤60) 2 l r 查询区间[ 阅读全文
posted @ 2018-05-01 08:08 楼主好菜啊 阅读(148) 评论(0) 推荐(0) 编辑
摘要:权值线段树,每个叶子结点都视为点的权值,在进行操作时要离散 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作: 1. 插入x数 2. 删除x数(若有多个相同的数,因只删除一个) 3. 查询x数的排名(若有多个相同的数,因输出最小的排名) 4. 查询排名为x的数 5. 求x的 阅读全文
posted @ 2018-04-30 07:27 楼主好菜啊 阅读(746) 评论(0) 推荐(1) 编辑
摘要:VVQ 最近迷上了线段这种东西 现在他手上有 n 条线段,他希望在其中找到两条有公共点的线段,使得他们的异或值最大。 定义线段的异或值为它们并的长度减他们交的长度 VVQ 最近迷上了线段这种东西 现在他手上有 n 条线段,他希望在其中找到两条有公共点的线段,使得他们的异或值最大。 定义线段的异或值为 阅读全文
posted @ 2018-04-10 18:52 楼主好菜啊 阅读(231) 评论(0) 推荐(0) 编辑
摘要:Alice likes snow a lot! Unfortunately, this year's winter is already over, and she can't expect to have any more of it. Bob has thus bought her a gift 阅读全文
posted @ 2018-03-12 09:19 楼主好菜啊 阅读(194) 评论(0) 推荐(0) 编辑
摘要:Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 阅读全文
posted @ 2018-02-03 19:14 楼主好菜啊 阅读(338) 评论(0) 推荐(0) 编辑
摘要:You are given an array consisting of n non-negative integers a1, a2, ..., an. You are going to destroy integers in the array one by one. Thus, you are 阅读全文
posted @ 2018-01-25 15:17 楼主好菜啊 阅读(222) 评论(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-01-20 09:13 楼主好菜啊 阅读(200) 评论(0) 推荐(1) 编辑
摘要:Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem. There is 阅读全文
posted @ 2018-01-15 11:04 楼主好菜啊 阅读(152) 评论(0) 推荐(0) 编辑
摘要:1. The cows are journeying north to Thunder Bay in Canada to gain cultural enrichment and enjoy a vacation on the sunny shores of Lake Superior. Bessi 阅读全文
posted @ 2018-01-02 16:48 楼主好菜啊 阅读(283) 评论(0) 推荐(0) 编辑
摘要:A number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Ea 阅读全文
posted @ 2017-10-24 12:29 楼主好菜啊 阅读(304) 评论(0) 推荐(0) 编辑
摘要:给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积. Input输入数据的第一行是一个正整数T(1<=T<=100),代表测试数据的数量.每个测试数据的第一行是一个正整数N(1<=N<=1000),代表矩形的数量,然后是N行数据,每一行包含四个浮点数,代表平面上的一个矩形的左上角坐标和右下 阅读全文
posted @ 2017-10-18 23:44 楼主好菜啊 阅读(216) 评论(0) 推荐(0) 编辑
摘要:There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the i 阅读全文
posted @ 2017-10-16 21:59 楼主好菜啊 阅读(393) 评论(0) 推荐(0) 编辑
摘要: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 compa 阅读全文
posted @ 2017-10-13 21:35 楼主好菜啊 阅读(312) 评论(0) 推荐(0) 编辑
摘要: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. Ea 阅读全文
posted @ 2017-10-11 20:03 楼主好菜啊 阅读(173) 评论(0) 推荐(0) 编辑
摘要:很多时候会遇到一类题, 这类题点的个数很少 , 但是每个点的数据特别大 , 这时基本有两种想法 。 1 . 用map 处理 , map 是一个关联容器 , 可以实现元素的一对一 , 用map 后 , 你就可以实现对数据的桶排了。 2 . 对数据离散化处理 先是点的离散化 例如 只有 3 个数据 , 阅读全文
posted @ 2017-10-10 15:18 楼主好菜啊 阅读(1137) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示