
莫队算法
SCUT_Pein
这个作者很懒,什么都没留下…
展开
-
POJ3241--Object Clustering(曼哈顿最小生成树)
DescriptionWe have N (N ≤ 10000) objects, and wish to classify them into several groups by judgement of their resemblance. To simply the model, each object has 2 indexes a and b (a, b ≤ 500). The原创 2014-09-04 18:36:58 · 736 阅读 · 0 评论 -
[2009国家集训队]小Z的袜子--莫队算法
Description作为一个生活散漫的人,小Z每天早上都要耗费很久从一堆五颜六色的袜子中找出一双来穿。终于有一天,小Z再也无法忍受这恼人的找袜子过程,于是他决定听天由命……具体来说,小Z把这N只袜子从1到N编号,然后从编号L到R(L 尽管小Z并不在意两只袜子是不是完整的一双,甚至不在意两只袜子是否一左一右,他却很在意袜子的颜色,毕竟穿两只不同色的袜子会很尴尬。你的任务便是告诉小Z原创 2014-09-05 22:02:24 · 3474 阅读 · 0 评论 -
SPOJ--Count on a tree II(树上莫队)
Description You are given a tree with N nodes.The tree nodes are numbered from 1 to N.Each node has an integer weight.We will ask you to perfrom the following operation:u v : ask for how原创 2014-10-14 00:50:13 · 938 阅读 · 0 评论