摘要: https://www.luogu.com.cn/problem/P2146 题意:给出一棵树,然后有两种操作,安装与卸载; 安装就是,想要安装这个软件,就得安装这个软件之前的一个软件,即:他的父亲,他的父亲的父亲.... 卸载就是,想要卸载这个软件,就得把这个软件的儿子都卸载了才能卸载; 那么他具 阅读全文
posted @ 2020-02-24 11:04 古比 阅读(157) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P2420 对于异或,就是将之前的求和的+号改为^ 即可 其他完全一样 1 #include<bits/stdc++.h> 2 using namespace std; 3 typedef long long LL; 4 const 阅读全文
posted @ 2020-02-24 10:59 古比 阅读(188) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P2590 模板题 1 #include<algorithm> 2 #include<iostream> 3 #include<cstdlib> 4 #include<cstring> 5 #include<cstdio> 6 #de 阅读全文
posted @ 2020-02-24 10:58 古比 阅读(146) 评论(0) 推荐(0) 编辑
摘要: https://www.luogu.com.cn/problem/P2486 题意:求出一段路径的颜色段数量; 很明显路径通常通过树剖来解决; 我们在树剖之后,查询两点之间颜色段的数量的时候,对于不同的两个区间,我们先将答案都加起来, 然后假如这两点区间的连接处颜色相同,我们再将答案减1; 那么什么 阅读全文
posted @ 2020-02-24 10:56 古比 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 链接:https://ac.nowcoder.com/acm/contest/4010/F?&headNav=acm 这是一道树链剖分的题目; 很容易想到,我们在树剖后,对于操作1,直接单点修改; 对于答案查询,我们直接的时候,我们假设查询的点是3,那么我们在查询的时候可分为两部分; 第一部分:查找 阅读全文
posted @ 2020-02-24 10:44 古比 阅读(195) 评论(0) 推荐(0) 编辑