Problem Description
Coco has a tree, whose nodes are conveniently labeled by 1,2,…,n, which has n-1 edge,each edge has a weight. An existing set S is initially empty.
Now there are two kinds of op...
分类:
其他好文 时间:
2016-07-25 01:53:01
阅读次数:
316
bzoj2588 Spoj 10628. Count on a tree 题意: n点树,m个询问求点u到点v路径上第k小的点权。强制在线。n,m≤100000 题解: 用主席树维护某节点到根节点的权值数量sz,建树过程可以由父亲节点递推。询问就用倍增求出lca,然后路径上的sz值就为sz[u]-s ...
分类:
其他好文 时间:
2016-07-24 17:39:38
阅读次数:
176
思博题加强版,还是思博题,RT,没了。 内存log^2,写了回收的话可以少个log。 lca不能用树剖了好悲伤(IoI),讨厌倍增。 没有1A好不爽啊啊啊,最近写思博题只有一道1A的是要退役的节奏(@_@) ...
分类:
其他好文 时间:
2016-07-23 07:22:58
阅读次数:
128
bzoj1787[Ahoi2008]Meet 紧急集合 题意: 给个树,每次给三个点,求与这三个点距离最小的点。 题解: 倍增求出两两之间的LCA后,比较容易理解的做法是挑出两个LCA再做一次LCA,比较所有挑法。但画kan出ti图jie可知其中有两个LCA是相等的,而所求就是那个与它们不等的LCA ...
分类:
其他好文 时间:
2016-07-20 21:19:03
阅读次数:
201
HDU - 5296
一棵树上有若干个点,每条边有一个边权
给一个初始为空的集合,每次向集合内添加一个点或者删除一个点
问每次操作结束后,将集合内所有点连起来的边权和为多少
假设集合内已经有一些点,那么再加一个点所增加的边权
将会是这个点到某一条链的距离但是这条链不能随便挑选,否则可能会经过已经选择的边
挑选策略就是,找到集合内dfsdfs序比当前点大和小的两个点组成的链
换句...
分类:
其他好文 时间:
2016-07-19 13:47:45
阅读次数:
174
A - Breadth-First Search by Foxpower Time Limit:2000MS Memory Limit:131072KB 64bit IO Format:%lld & %llu Submit Status A - Breadth-First Search by Fox ...
分类:
其他好文 时间:
2016-07-19 09:41:00
阅读次数:
121
题目链接:http://codeforces.com/problemset/problem/697/D 给你一个有规则的二叉树,大概有1e18个点。 有两种操作:1操作是将u到v上的路径加上w,2操作是求u到v上的路径和。 我们可以看出任意一个点到1节点的边个数不会超过64(差不多就是log2(1e ...
分类:
其他好文 时间:
2016-07-15 19:50:42
阅读次数:
176
A - Breadth-First Search by Foxpower Problem Statement Fox Ciel went to JAG Kingdom by bicycle, but she forgot a place where she parked her bicycle. S ...
分类:
其他好文 时间:
2016-07-14 19:22:35
阅读次数:
149
Given a binary tree, find the lowest common ancestor (LCA) of two given nodes in the tree. According to the definition of LCA on Wikipedia: “The lowes ...
分类:
编程语言 时间:
2016-07-14 10:13:39
阅读次数:
211
Network Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 4478 Accepted: 1292 Description Yixght is a manager of the company called SzqNetwor ...
分类:
其他好文 时间:
2016-07-14 10:09:42
阅读次数:
249