摘要: pair_hash struct PairHash { size_t operator()(const pair<int,int>& p) const { return hash<int>{}(p.first)^ hash<int>{}(p.second); } }; View Code vecto 阅读全文
posted @ 2022-07-09 21:35 80k 阅读(103) 评论(0) 推荐(0)
摘要: 解决的问题: 1、快速求前缀和(logn)(区间求和) 2、修改某一个数(logn)(单点修改) 对比:数组:求前缀和On,修改O1;前缀和数组:求前缀和O1,修改On C[x]表示,以x结尾,长度为lowbit(x)的区间中的计数 查询: 修改: 模板: int a[200010]; LL tr[ 阅读全文
posted @ 2022-07-09 20:01 80k 阅读(40) 评论(0) 推荐(0)
摘要: 连通分量可以用并查集处理。 连通分量是环的条件可以是:边数等于点数,每个点的度都为2。 例题:AcWing 4493. 环形连通分量 #include<bits/stdc++.h> using namespace std; typedef long long LL; int p[200010]; i 阅读全文
posted @ 2022-07-09 19:43 80k 阅读(63) 评论(0) 推荐(0)