
树状数组&&线段树
Joovo
成事不说,遂事不谏,既往不咎。
展开
-
整理的树状数组模板 & 敌兵布阵 HDU - 1166
题目链接: HDU-1166 参考资料: 夜深人静写算法三 树状数组学习小结树状数组 ( Binary Indexed Tree,BIT,二分索引树 ),基本操作是操作线性表的数据的。两个链接都写得很详细,这里给出一些帮助理解和要注意的要点:下标index由1开始下标为 i ,i 后面有 k 个 0 就管理 2^k 个 Ai,下标为奇数的,只管理一个Ailowbit() 获取最右端的原创 2017-03-26 11:21:17 · 421 阅读 · 0 评论 -
2017年ZJUT校赛-Problem B: 平方2——树状数组
Problem B: 平方2——分析,树状数组 Description tw 很喜欢收集int范围内的数字,当有一天他终于收集到了N个数字,并把它们排成一排时,突然出现了一条神龙,神龙说我可以实现你一些愿望,你从这N个数字中找到符合x^2 < z^2 < y^2的偏序三元组(x,y,z)(即顺序为x在前,y在中间,z在后),这样的三元组的个数就是你能实现的愿望数tw想知道他能实现多少愿望Inpu原创 2017-04-03 21:27:30 · 787 阅读 · 0 评论 -
A Simple Problem with Integers POJ - 3468 线段树模板
题目链接: POJ-3468大意: 区间修改,区间求和。线段树模板题。线段树与树状数组比较: 线段树的功能更强大,但树状数组的常数较小。#include <iostream>#include <cstring>#include <string>#include <cmath>using namespace std;typedef long long ll;#define mem(s原创 2017-09-03 13:00:35 · 451 阅读 · 0 评论 -
Computer Science Gym - 101510C
Computer Science Gym-101510C Description: Vera has N integers a1, …, aN. A margin is a non-negative integer L such that it is possible to choose N integers x1, …, xN such that for all i, 1 ≤ i ≤ N,原创 2018-01-29 15:24:26 · 603 阅读 · 0 评论