Live2d Test Env

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

摘要:给定一棵N个节点的树,编号1~N。其中1号节点是根,并且第i个节点的权值是Vi。 针对这棵树,小Hi会询问小Ho一系列问题。每次小Hi会指定一个节点x,询问小Ho以x为根的子树中,最小的权值是多少。为了增加难度,小Hi可能随时改变其中每个节点的权值。 你能帮助小Ho准确、快速的回答小Hi的问题吗? 阅读全文
posted @ 2018-01-10 21:04 nimphy 阅读(445) 评论(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-05 14:07 nimphy 阅读(283) 评论(0) 推荐(0)
摘要:描述 小Ho:好麻烦啊~~~~~ 小Hi:小Ho你在干嘛呢? 小Ho:我在干活啊!前几天老师让我帮忙管理一下团队的人员,但是感觉好难啊。 小Hi:说来听听? 小Ho:事情是这样的。我们有一个运动同好会,每天都有人加入或者退出,所以老师让我帮忙管理一下人员。每个成员有一个互不相同的id和他对我们同好会 阅读全文
posted @ 2018-01-02 20:47 nimphy 阅读(749) 评论(0) 推荐(0)
摘要:You are given a tree with N nodes. The tree’s nodes are numbered 1 through N and its edges are numbered 1 through N − 1. Each edge is associated with 阅读全文
posted @ 2017-12-21 15:39 nimphy 阅读(202) 评论(0) 推荐(0)
摘要:After their royal wedding, Jiajia and Wind hid away in XX Village, to enjoy their ordinary happy life. People in XX Village lived in beautiful huts. T 阅读全文
posted @ 2017-12-20 17:30 nimphy 阅读(333) 评论(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 some instruct 阅读全文
posted @ 2017-12-18 21:57 nimphy 阅读(204) 评论(0) 推荐(0)
摘要:时间限制:10000ms 单点时限:1000ms 内存限制:256MB 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Ho在玩一款类似俄罗斯方块的游戏。与原版俄罗斯方块不同的是,落下方块都是长度不一的横向长条,并且不能移动也不能变成竖直方向。 XXXXXX <- 长 阅读全文
posted @ 2017-12-17 16:40 nimphy 阅读(308) 评论(0) 推荐(0)
摘要:描述 兔子们在玩k个串的游戏。首先,它们拿出了一个长度为n的数字序列,选出其中的一个连续子串,然后统计其子串中所有数字之和(注意这里重复出现的数字只被统计一次)。 兔子们想知道,在这个数字序列所有连续的子串中,按照以上方式统计其所有数字之和,第k大的和是多少。 输入 第一行,两个整数n和k,分别表示 阅读全文
posted @ 2017-12-03 09:37 nimphy 阅读(327) 评论(0) 推荐(0)
摘要:The Company Dynamic Rankings has developed a new kind of computer that is no longer satisfied with the query like to simply find the k-th smallest num 阅读全文
posted @ 2017-11-29 16:24 nimphy 阅读(317) 评论(0) 推荐(0)
摘要:描述 小Hi和小Ho都是游戏迷,“模拟都市”是他们非常喜欢的一个游戏,在这个游戏里面他们可以化身上帝模式,买卖房产。 在这个游戏里,会不断的发生如下两种事件:一种是房屋自发的涨价或者降价,而另一种是政府有关部门针对房价的硬性调控。房价的变化自然影响到小Hi和小Ho的决策,所以他们希望能够知道任意时刻 阅读全文
posted @ 2017-11-28 21:35 nimphy 阅读(219) 评论(0) 推荐(0)
摘要:每个测试点(输入文件)有且仅有一组测试数据。 每组测试数据的第1行为一个整数N,意义如前文所述。 每组测试数据的第2行为N个整数,分别描述每种商品的重量,其中第i个整数表示标号为i的商品的重量Pi。 每组测试数据的第3行为一个整数Q,表示小Hi进行的操作数。 每组测试数据的第N+4~N+Q+3行,每 阅读全文
posted @ 2017-11-28 18:41 nimphy 阅读(193) 评论(0) 推荐(0)
摘要:个测试点(输入文件)有且仅有一组测试数据。 每组测试数据的第1行为一个整数N,意义如前文所述。 每组测试数据的第2行为N个整数,分别描述每种商品的重量,其中第i个整数表示标号为i的商品的重量weight_i。 每组测试数据的第3行为一个整数Q,表示小Hi总共询问的次数与商品的重量被更改的次数之和。 阅读全文
posted @ 2017-11-28 14:56 nimphy 阅读(246) 评论(0) 推荐(0)
摘要:Problem Description Chinese always have the railway tickets problem because of its' huge amount of passangers and stations. Now goverment need you to 阅读全文
posted @ 2017-11-28 10:56 nimphy 阅读(227) 评论(0) 推荐(0)
摘要:Newman likes playing with cats. He possesses lots of cats in his home. Because the number of cats is really huge, Newman wants to group some of the ca 阅读全文
posted @ 2017-11-27 21:04 nimphy 阅读(207) 评论(0) 推荐(0)
摘要:以前都是用的BIT或者线段树(前者多一些)。 对于ST(Sparse Table),在求倍增or公共祖先(LCA)时见过,说明还有其他用处,所以还是学习一下。 首先是预处理,用动态规划(DP)解决。 设A[i]是要求区间最值的数列,F[i, j]表示从第i个数起连续2^j个数中的最大值。(DP的状态 阅读全文
posted @ 2017-11-05 10:59 nimphy 阅读(282) 评论(0) 推荐(0)
摘要:昨天睡得太晚,今天又在看新算法,明天事情也多,烦,所以今天刷刷水题就过去了。 叫我用线段树,我反而搞不来 阅读全文
posted @ 2017-10-17 19:28 nimphy 阅读(195) 评论(0) 推荐(0)
摘要:Chiaki has n intervals and thei-th of them is [li,ri]. She wants to delete some intervals so that there does not exist three intervalsa,b andc such th 阅读全文
posted @ 2017-09-27 21:06 nimphy 阅读(383) 评论(0) 推荐(0)
摘要:敌兵布阵 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 99913 Accepted Submission(s): 42300 Problem 阅读全文
posted @ 2017-09-27 21:06 nimphy 阅读(127) 评论(0) 推荐(0)
摘要:Longest Ordered SubsequenceTime Limit: 2 Seconds Memory Limit:65536 KB A numeric sequence of ai is ordered if a1 #include#include#includeusing na... 阅读全文
posted @ 2017-09-27 21:06 nimphy 阅读(128) 评论(0) 推荐(0)