上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 68 下一页
摘要: 可持久化并查集模板(启发式合并) #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pll; typedef pair<int,pll> plll; const int N 阅读全文
posted @ 2020-08-23 20:51 朝暮不思 阅读(159) 评论(0) 推荐(0)
摘要: #include <bits/stdc++.h> #define INF (1<<25) #define MAXN 200005 #define getSZ(p) (p?p->sz:0) #define getSUM(p) (p?p->sum:0) using namespace std; type 阅读全文
posted @ 2020-08-23 19:40 朝暮不思 阅读(101) 评论(0) 推荐(0)
摘要: 主要是思想是对顶堆,将最大的雷电法术的放入加强集合,其他放入普通集合 之后维护两种法术的集合大小,因为每次操作最多只会将大小与真正的大小差1,因此判断更新即可 具体注释看代码,细节比较多,主要是注意判断集合是否非空 #include<bits/stdc++.h> using namespace st 阅读全文
posted @ 2020-08-23 15:22 朝暮不思 阅读(177) 评论(0) 推荐(0)
摘要: 线段树维护区间取反和区间覆盖操作。 注意他们的优先级。 #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int,int> pll; typedef pair<int,pll> plll; 阅读全文
posted @ 2020-08-23 09:52 朝暮不思 阅读(143) 评论(0) 推荐(0)
摘要: 字典树的裸题,插入删除很简单,对于查询,只要进行分类讨论,先计算合法方案,然后使得相异或的答案永远和l保持一致即可 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=3e6+10; int c 阅读全文
posted @ 2020-08-21 23:16 朝暮不思 阅读(141) 评论(0) 推荐(0)
摘要: 显然,对于一个点确定了,那么整棵树都确定了,因此我们枚举每个点作为不变点 之后用f[i]表示该节点固定时答案是多少,这样就能跑出正确答案了 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=1 阅读全文
posted @ 2020-08-21 20:44 朝暮不思 阅读(80) 评论(0) 推荐(0)
摘要: #include<iostream> #include<algorithm> #include<string> #include<cstring> #include<cstdio> #include<queue> using namespace std; typedef pair<int,int> 阅读全文
posted @ 2020-08-21 19:30 朝暮不思 阅读(143) 评论(0) 推荐(0)
摘要: 由题意可知,可以分别统计以i为根的子树距离mod3的情况,并记录个数,之后用点分治可以使复杂度降到nlogn #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=3e5+10; const in 阅读全文
posted @ 2020-08-21 18:36 朝暮不思 阅读(124) 评论(0) 推荐(0)
摘要: 二分最小值,能选第一个尽量选,之后选第二个看看能否满足答案 #include<bits/stdc++.h> using namespace std; typedef long long ll; const int N=3e5+10; const int mod=1e7+7; int n,m,k; s 阅读全文
posted @ 2020-08-21 16:06 朝暮不思 阅读(117) 评论(0) 推荐(0)
摘要: 这题只需要记录到当前位,之前总共有多少个1即可 因为首先这满足记忆化的条件,也就是可以在计算过的情况下直接范围答案 其次,我们现在需要理解的是,当我们计算出了这个之后,答案是可以直接累乘的 因为在某个数之后计算的所有数,最大值不超过他,也就是他这位所管辖的所有答案。 所以我们可以想到,这样其实就是把 阅读全文
posted @ 2020-08-20 23:16 朝暮不思 阅读(98) 评论(0) 推荐(0)
上一页 1 ··· 24 25 26 27 28 29 30 31 32 ··· 68 下一页