摘要: 字典树的裸题,插入删除很简单,对于查询,只要进行分类讨论,先计算合法方案,然后使得相异或的答案永远和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 朝暮不思 阅读(126) 评论(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)