树状数组
ffutop
这个作者很懒,什么都没留下…
展开
-
Ural 2062
During several decades, scientists from planet Nibiru are working to create an engine that would allow spacecrafts to fall into hyperspace and move there with superluminal velocity. To check whether their under原创 2017-02-17 09:25:15 · 416 阅读 · 0 评论 -
ZOJ 3955 Saddle Point (树状数组)
H. Saddle PointChiaki has an n × m matrix A. Rows are numbered from 1 to n from top to bottom and columns are numbered from 1 to m from left to right. The element in the i-th row and the j-th column is原创 2017-04-12 11:15:29 · 542 阅读 · 0 评论 -
Codeforces Round #423 E. DNA Evolution (树状数组)
ProblemS 串为 DNA 串(即仅包含字母 ACGT )。有 q 组询问,询问有两种形式:1 x c 将 S 串中第 x 个位置的字符修改为 c 。2 l r e ,判断 S 截取区间 [l, r] 的子串,与 e 串的相同位置字符相同的个数。(其中若 e 串长度不足 r−l+1r-l+1 ,则通过 e = e+e 的形式复制加长。 限制条件1 ≤ |S| ≤ 1051 ≤ |S| ≤原创 2017-07-13 08:50:43 · 693 阅读 · 0 评论 -
Codeforces Gym 101190 (NEERC 2016) H. Hard Refactoring (模拟 + 树状数组)
H - Hard Refactoring题意Helen had come upon a piece of code that uses a lot of “magical constants”. She found a logical expression that checks if an integer x belongs to a certain set of ranges, like the原创 2017-06-25 10:30:39 · 1042 阅读 · 0 评论 -
Codeforces Gym F. Performance Review (树状数组 + DFS 序)
Problem给定一个有根树,每个点给定其父节点 fa ,自身的 rank ,以及自身的一个 value 值。任意一个点对其祖先产生贡献,当且仅当该点 rank 小于其祖先的 rank ,贡献度为该点的 value 值。问树上每个点的贡献值。限制条件1 ≤ E ≤ 100000 1 ≤ ri ≤ 1000001 ≤ ti ≤ 100000解题思路考虑用树状数组单点更新每个 rank 产生的 valu原创 2017-07-14 16:58:26 · 596 阅读 · 0 评论 -
HDU 6078 Wavel Sequence (dp + 树状数组, 2017 Multi-Univ Training Contest 4)
Problem含 N 个数的 a 数组 a1,a2,⋯,ana_1, a_2,\cdots, a_n 和含 M 个数的 b 数组 b1,b2,⋯,bmb_1, b_2,\cdots, b_m ,求有多少 a,b 公共子序列(记作 arr, 长为 len )满足 arr1<arr2>arr3<arr4>arr5⋯arr_1 \lt arr_2\gt arr_3\lt arr_4 \gt arr_5\c原创 2017-08-04 10:02:29 · 684 阅读 · 0 评论 -
HDU 6133 Army Formations (树状数组, 2017 Multi-Univ Training Contest 8)
ProblemProblem LinkThough being cruel and merciless in the battlefields, the total obedience to the command hierarchy makes message delivering between Stormtroopers quite inefficient, which finally cau原创 2017-08-21 10:59:40 · 443 阅读 · 0 评论 -
HDU 6203 ping ping ping (LCA + 树状数组, 2017 ACM/ICPC Asia Regional Shenyang Online)
Problemn+1 个点 n 条边的树(点标号 0 ~ n),有若干个点无法通行,导致 p 组 U V 无法连通。问无法通行的点最少有多少个。Idea根据所给的树(任意点为根)预处理出每个点的前序 DFS 序和后序 DFS 序(需统一标号),及点的深度。根据 p 组 U V 处理每组两点的 LCA 。压入优先队列(LCA 深度大的点优先出队)。对于出队的 U V 及其对应的 LCA ,判断点 U原创 2017-09-11 09:19:30 · 1606 阅读 · 0 评论 -
Codeforces Round #439 E. The Untended Antiquity (树状数组+随机化)
ProblemProblem Link在 n×mn\times m 的二维图上,有三种操作:1 r1 c1 r2 c2 表示沿着 (r1, c1, r2, c2) 所表示的矩形的外边框建围墙。(其中 (r1, c1) 为矩形左上角,(r2, c2) 表示矩形右下角)。2 r1 c1 r2 c2 表示取消 (r1, c1, r2, c2) 所示矩形的围墙。(保证最初图不存在围墙,删除的围墙一定是之原创 2017-10-07 14:13:11 · 680 阅读 · 0 评论