随笔分类 - 树上乱搞---树上差分
摘要:Vasya has a tree consisting of n n vertices with root in vertex 1 1 . At first all vertices has 0 0 written on it. Let d(i,j) d(i,j) be the distance b
阅读全文
摘要:Description 给您一颗树,每个节点有个初始值。 现在支持以下两种操作: 1. C i x(0<=x<2^31) 表示将i节点的值改为x。 2. Q i j x(0<=x<2^31) 表示询问i节点到j节点的路径上有多少个值为x的节点。 给您一颗树,每个节点有个初始值。 现在支持以下两种操作
阅读全文
摘要:这里有三道长得像的题: 一: HDU6036: There is a tree with nn nodes, each of which has a type of color represented by an integer, where the color of node ii is cici
阅读全文
摘要:关键词:并查集,二分图,树剖,树上差分,LCA,搜索。 例题一: CodeForces-85E:Guard Towers 题意:给定平面上N个点(N<=5000),以及N个点的坐标。现在可以把每个点染成红色或者蓝色。求最小化同色点的最大距离,且求出相应的方案数。 思路:二分答案L,把距离大于等于L的
阅读全文
摘要:In an edge-weighted tree, the xor-length of a path p is defined as the xor sum of the weights of edges on p: ⊕ is the xor operator. We say a path the
阅读全文
摘要:一:解决XOR常用的方法: 在vjudge上面输入关键词xor,然后按照顺序刷了一些题。 然后大概悟出了一些的的套路: 我是分界线 POJ 3764: The xor-longest 字典树求最大异或 POJ 3764: The xor-longest 字典树求最大异或 #include<cmath
阅读全文
摘要:Yixght is a manager of the company called SzqNetwork(SN). Now she's very worried because she has just received a bad news which denotes that DxtNetwor
阅读全文