莫队算法
文章平均质量分 76
安庆闪耀
这个作者很懒,什么都没留下…
展开
-
CSU 1515: Sequence(莫队算法)
Description Give you a sequence consisted of n numbers. You are required to answer how many pairs of numbers (ai, aj) satisfy that | ai - aj | = 1 and L ≤ i Input The input consists of原创 2016-04-20 20:37:45 · 345 阅读 · 0 评论 -
codeforces 86D. Powerful array(莫队算法)
An array of positive integers a1, a2, ..., an is given. Let us consider its arbitrary subarray al, al + 1..., ar, where 1 ≤ l ≤ r ≤ n. For every positive integer s denote by Ks the number of o原创 2016-04-20 20:35:27 · 2353 阅读 · 0 评论 -
bzoj 2038: [2009国家集训队]小Z的袜子(hose)(莫队算法)
Description 作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命…… 具体来说,小Z把这N只袜子从1到N编号,然后从编号L到R(L 尽管小Z并不在意两只袜子是不是完整的一双,甚至不在意两只袜子是否一左一右,他却很在意袜子的颜色,毕竟穿两只不同色的袜子会很尴尬。 你的任务便是告诉小Z原创 2016-04-20 20:32:25 · 1295 阅读 · 0 评论 -
bzoj 1878: [SDOI2009]HH的项链(莫队算法)
Description HH有一串由各种漂亮的贝壳组成的项链。HH相信不同的贝壳会带来好运,所以每次散步 完后,他都会随意取出一段贝壳,思考它们所表达的含义。HH不断地收集新的贝壳,因此, 他的项链变得越来越长。有一天,他突然提出了一个问题:某一段贝壳中,包含了多少种不同 的贝壳?这个问题很难回答。。。因为项链实在是太长了。于是,他只好求助睿智的你,来解 决这个问题。 Input 第原创 2016-04-20 20:30:30 · 1268 阅读 · 0 评论 -
hdu 4638 Group(莫队算法)
Problem Description There are n men ,every man has an ID(1..n).their ID is unique. Whose ID is i and i-1 are friends, Whose ID is i and i+1 are friends. These n men stand in line. Now we select an原创 2016-04-20 20:26:18 · 1580 阅读 · 1 评论