
线段树
untilyouydc
月份未到你也得接受
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU - 6315 Naive Operations
In a galaxy far, far away, there are two integer sequence a and b of length n. b is a static permutation of 1 to n. Initially a is filled with zeroes. There are two kind of operations: 1. add l r: ...原创 2018-07-26 19:41:12 · 220 阅读 · 0 评论 -
HDU 6356 Glad You Came(unsigned int + 线段树 )
Problem Description Steve has an integer array a of length n (1-based). He assigned all the elements as zero at the beginning. After that, he made m operations, each of which is to update an interval...原创 2018-08-06 20:50:19 · 228 阅读 · 0 评论 -
Water Tree CodeForces - 343D (dfs序+线段树)
Mad scientist Mike has constructed a rooted tree, which consists of n vertices. Each vertex is a reservoir which can be either empty or filled with water. The vertices of the tree are numbered from 1...原创 2018-08-26 20:35:15 · 393 阅读 · 0 评论 -
DZY Loves Fibonacci Numbers CodeForces - 446C (二次剩余+线段树维护等比数列)
二次剩余: 斐波那契通项公式: 先打表求出根号5在模1e9+9意义下的数。 然后就化简成立区间加上等比数列的形式,维护每段区间加了多少次等比数列就行。 下面我们来看如何维护一个等比数列。假如我对区间[L,R]的加上1,2,4,8...2^n的话,那么我只需要加一个标记x表示这个区间被加了多少次这样的2^n. 举个例子 [1,8] 上加一个等比数列,我只需要x+=1,...原创 2018-11-02 13:43:48 · 555 阅读 · 0 评论 -
简单的字符串(回文子集数+二维线段树)
题目: 思路:第一步先处理如何计算一个区间的回文子集个数 构成回文串,有两种情况: 1. 每种字母都选偶数个,这样一定可以构成回文串 2. 有一种字母选了奇数个,其他的选了偶数个,这样也一定可以构成回文串 对于每种字母选偶数个或奇数个的选择方法数,都可以用二项式定理得到2^(cnt-1)。那么对应...原创 2018-11-25 21:25:26 · 295 阅读 · 0 评论 -
敌兵布阵 HDU - 1166(简单线段树)
题意:已经很明显了。 思路:直接上线段树 反思:差点连线段树都没打出来,给人一种英雄迟暮的感觉。突然想起我好像没写过介绍线段树的博客,希望以后能补上吧。 代码: #include <iostream> #include <stdio.h> #include <vector> #include <algorithm> #include <...原创 2019-01-31 18:36:30 · 145 阅读 · 0 评论