讲道理我是调不出来了...

考虑对序列按下标维护每个节点最后的树.

那么

  1. 改操作点 - 把一段连续的节点改父亲
  2. 加点/删点(注意拆成两个操作了) 插儿子

那么用seg维护一下下标, 用ETT维护Depth和MinDepth, 打标记就能维护了.

ETT+Seg

细节很多,写了400行.

ZJOIDay2T1 BB题解的更多相关文章

  1. JSOI2016R3 瞎BB题解

    题意请看absi大爷的blog http://absi2011.is-programmer.com/posts/200920.html http://absi2011.is-programmer.co ...

  2. Spring-2-J Goblin Wars(SPOJ AMR11J)解题报告及测试数据

    Goblin Wars Time Limit:432MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Description Th ...

  3. 51nod 1317 相似字符串对(容斥原理+思维)

    题意: 称一对字符串(A,B)是相似的,当且仅当满足以下条件: (1)字符串A和B都恰好包含N个字符: (2)A和B串中的每个字符都是小写字母的前k个字符,即A.B中只可能出现'a','b','c', ...

  4. 【LeetCode】005. Longest Palindromic Substring

    Given a string s, find the longest palindromic substring in s. You may assume that the maximum lengt ...

  5. Leetcode 5. Longest Palindromic Substring(最长回文子串, Manacher算法)

    Leetcode 5. Longest Palindromic Substring(最长回文子串, Manacher算法) Given a string s, find the longest pal ...

  6. Java算法练习——最长回文子串

    题目链接 题目描述 给定一个字符串 s,找到 s 中最长的回文子串.你可以假设 s 的最大长度为 1000. 示例 1 输入: "babad" 输出: "bab" ...

  7. noip2016十连测题解

    以下代码为了阅读方便,省去以下头文件: #include <iostream> #include <stdio.h> #include <math.h> #incl ...

  8. JSOI Round 2题解

    强行一波题解骗一个访问量好了... http://blog.csdn.net/yanqval/article/details/51457302 http://absi2011.is-programme ...

  9. Codeforces Round #383 (Div. 2) 题解【ABCDE】

    Codeforces Round #383 (Div. 2) A. Arpa's hard exam and Mehrdad's naive cheat 题意 求1378^n mod 10 题解 直接 ...

随机推荐

  1. QT 初阶 1.3 节 控件的几何排列

    #include "mainwindow.h" #include <QApplication> #include <QHBoxLayout> #includ ...

  2. Using Friendly URLs in ASP.NET Web Forms

    Introduction Websites often need to generate SEO friendly URLs. In ASP.NET Web Forms applications, a ...

  3. History(历史)命令用法

    如果你经常使用 Linux 命令行,那么使用 history(历史)命令可以有效地提升你的效率.本文将通过实例的方式向你介绍 history 命令的用法. 使用 HISTTIMEFORMAT 显示时间 ...

  4. MYTOP安装和使用

    安装 mytop 1. 在 /etc/yum.repo.d 新建一个文件 21andy.com.repo [21Andy.com] name=21Andy.com Packages for Enter ...

  5. 记录两张数据库表及Ibatis操作

    建表语句 CREATE TABLE `TS_MopayInvoiceComposition` ( `ID` int(11) NOT NULL AUTO_INCREMENT, `RequestID` i ...

  6. Centos7安装rabbitmq server 3.6.0

    ###假设所有操作在opt目录下进行 cd /opt mkdir apps cd apps ### 下载 RabbitMQ Server wget http://www.rabbitmq.com/re ...

  7. 获取C#代码执行的时间(精确到毫秒)

    using System.Diagnostics;//引用相关的命名空间Stopwatch st=new Stopwatch ();//实例化类st. Start();//开始计时 //需要统计时间的 ...

  8. apt-get方式安装lnmp环境

    安装nginxsudo apt-get install nginx安装php和mysqlsudo apt-get install php5-cli php5-cgi php5-curl php5-my ...

  9. C语言中的EOF和回车不一样

    经常我们碰到这样一个C语言问题,例如: 输入一个组整数,按照从小到大排序后输出结果 输入:  1 7 9 2 4 输出:  1 2 4 7 9 这里要用C语言读入一段数的话,如果用 int array ...

  10. HighCharts选项和参数详细配置查询表

    概述:作为一款出色的交互图表制作工具,HighCharts有着全面的选项.参数等配置信息.为了帮助大家进一步掌握HighCharts,今天我们为大家整理了HighCharts的所有配置信息和说明,将其 ...