随笔分类 -  数据结构

摘要:#include<cstdio> #include<cstring> #include<algorithm> #define mid (l+r)/2 using namespace std; typedef long long ll; const int N = 200010; int n, q, 阅读全文
posted @ 2021-08-14 14:24 莳曳 阅读(114) 评论(0) 推荐(0)
摘要:洛谷P2801 → Click Here ##题意 ##思路 Code #include<iostream> #include<cstdio> #include<algorithm> #include<cmath> using namespace std; const int MAXN = 1e6 阅读全文
posted @ 2021-08-13 16:11 莳曳 阅读(27) 评论(0) 推荐(0)
摘要:笔者蒟蒻一只,如有错误和不准确不严谨的地方望指正 orz 什么是树状数组 树状数组 $=$​ 二进制索引数 $=$​​ BIT ( Binary Indexed Tree 可以用来求序列的前缀和,将复杂度降到 \(O(log_{10}n)\) 大致图为(以前16个数为例 图中的非叶子节点都代表这一个 阅读全文
posted @ 2021-08-09 17:03 莳曳 阅读(50) 评论(0) 推荐(0)
摘要:洛谷 P1908 → Click Here 题意 $\mathcal{Tom}$​​ 和 $\mathcal{Jerry}$​​ 在 van♂游戏:找出一序列中逆序对的个数 逆序对就是序列中 \(a_i>a_j\) 且 \(i<j\) 的有序对 思路 BIT $=$​ 树状数组 $=$​ 二进制查找 阅读全文
posted @ 2021-08-08 16:51 莳曳 阅读(35) 评论(0) 推荐(0)
摘要:CodeForces 587C → Click Here 题意 一棵树,树上节点包括一些数,可以当作一个节点的属性,问从节点 \(l\) 到节点 \(r\) 的所有数中从小到大取前 \(a\) 个 (\(a\leq10\)) 思路 很好的一道练习倍增LCA题,考察了倍增思想和运用 观察到每个节点有两 阅读全文
posted @ 2021-08-03 10:48 莳曳 阅读(53) 评论(0) 推荐(0)
摘要:CodeForces 1549D → Click Here 题意 数组$a_1,a_2,a_3,...,a_n$​​中定义一个 subarray $a_i,a_{i+1},a_{i+2},...,a_{j}$​​​ 为friends group 当且仅当存在一个$m$​使得$a_i %m=a_{i+ 阅读全文
posted @ 2021-08-03 09:56 莳曳 阅读(118) 评论(0) 推荐(0)
摘要:D. 0-1 MST map用例 ::iterator inerator stl map 的 map<int,int>::iterator it 迭代器 用于遍历map中的每一个函数 D. 0-1 MST CodeForces 1243D → Click here 题意 一个 n 个节点的完整图,m 阅读全文
posted @ 2021-08-02 22:31 莳曳 阅读(60) 评论(0) 推荐(0)