![](https://img-blog.csdnimg.cn/20190927151124774.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
线段树
线段树
键盘里敲打出的巨人
这个时代带给我太多太多,我也要回馈这个时代!!
展开
-
cf D. Distinct Characters Queries
题目链接:http://codeforces.com/problemset/problem/1234/D题意:可修改某个字符,求区间字符种类有几种;解题思路:明显的线段树区间和问题,把每个字母单独一个变量,每个节点就有26个计算出现数量即可,为0表示没有,最后遍历查询节点的26个字母出现情况,就是答案。ac代码:#include <cstdio>#includ...原创 2019-10-28 10:20:40 · 187 阅读 · 0 评论 -
K. Addition Robot 线段树+锻炼合并思路
题目链接:https://codeforces.com/problemset/problem/1252/K留个思路,以后好给学弟学妹出些线段树题。。。1LLRR. The robot should toggle all the characters ofSiSiwhereL≤i≤RL≤i≤R. Toggling a character means changing it to '...原创 2019-11-08 20:55:58 · 158 阅读 · 0 评论 -
重新捡起博客 区域赛训练之西安站 G - Sum of xor sum UVALive - 8518
区间异或和二进制线段树合并题目链接: https://nanti.jisuanke.com/t/A1613ac代码:#include <cstdio>#include <math.h>#include <algorithm>#include <cstring>#include <queue>#include <io...原创 2019-10-17 11:16:34 · 181 阅读 · 0 评论 -
Atlantis (线段树-离散化-并面积)(基础题)
Atlantis 这题是最基层,但我也看了好久的大佬的博客才看懂:https://blog.csdn.net/qq_18661257/article/details/47622677题意:计算出所有矩形的面积。主要思路:把图的上下两条边分别赋值为下边为1,上边为-1,这是为了判断用;先建个树这里的cover是表示区间是否存在,flag表示上下边1或-1,node表示节点,X[l] ~ X[r],这...翻译 2018-05-28 17:29:31 · 255 阅读 · 0 评论 -
等差子数列->线段树维护
题目链接https://cn.vjudge.net/problem/HihoCoder-1710 orhttps://hihocoder.com/login等差子数列题目:给定N个整数A1, A2, … AN,小Hi会询问你M个问题。对于每个问题小Hi给出两个整数L和R(L ≤ R),请你找出[AL, AL+1, AL+2, … AR]中最长的等差连续子数列,并输出其长度。例如[2, 3...原创 2019-04-05 09:09:18 · 256 阅读 · 0 评论