
二叉树-伸展树
文章平均质量分 87
RJ28
小学生
展开
-
POJ-3468 A Simple Problem with Integers(Splay实现)
POJ 3468 A Simple Problem with Integers(Splay实现)原创 2016-04-21 13:42:34 · 333 阅读 · 0 评论 -
hdu-1890 Robotic Sort
Time Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3477 Accepted Submission(s): 1504Problem DescriptionSomewhere deep in the Czech Tec原创 2016-04-21 22:41:15 · 466 阅读 · 0 评论 -
Gym 100960G Youngling Tournament(splay)
Descriptionstandard input/outputStatementsYoda, the Grand Master of the Jedi Order, hit on the idea to hold a tournament among younglings. He has not chosen the date yet, but he has already de原创 2016-09-01 00:24:58 · 598 阅读 · 0 评论 -
ICPCCamp 2017-Day1 E.Lowest Common Ancestor(树链剖分/lct)
题意:给一棵带权树,问每个点和所有标号小于它的点的带权lca和。分析:这种lca和可以看成是两段权值不同的链的差,这样我们用lct来维护树上每段链的带权重量和,每次插入一个点。#include#include#include#include#include#include#include#include#include#include#include#原创 2017-02-13 08:52:36 · 413 阅读 · 0 评论 -
Bzoj-2243 [SDOI2011]染色(动态树/树链剖分)
Description给定一棵有n个节点的无根树和m个操作,操作有2类:1、将节点a到节点b路径上所有点都染成颜色c;2、询问节点a到节点b路径上的颜色段数量(连续相同颜色被认为是同一段),如“112221”由3段组成:“11”、“222”和“1”。请你写一个程序依次完成这m个操作。Input第一行包含2个整数n和m,分别表示节点原创 2017-01-28 20:10:08 · 308 阅读 · 0 评论 -
SPOJ-GSS7 Can you answer these queries VII(树上区间最大和)
Given a tree with N (N |x_i|You have to apply Q (Q 1. 1 a b : answer the maximum contiguous sum (maybe empty,will always larger than or equal to 0 ) from the path a->b ( inclusive ).2. 2 a b c :原创 2017-01-28 21:15:22 · 637 阅读 · 0 评论 -
Bzoj-2759: 一个动态树好题
Description有N个未知数x[1..n]和N个等式组成的同余方程组:x[i]=k[i]*x[p[i]]+b[i] mod 10007其中,k[i],b[i],x[i]∈[0,10007)∩Z你要应付Q个事务,每个是两种情况之一:一.询问当前x[a]的解A a无解输出-1x[a]有多解输出-2否则输出x[a]二.修改一个等式C a k[a] p原创 2016-12-28 20:16:58 · 584 阅读 · 0 评论