摘要:
hash+主席树,把hash值挂到主席树上,查询区间是否存在即可。 (我才不会告诉你我的模数被卡了5发) include include include typedef unsigned long long ll; using namespace std; int n,m,k,rt[200005], 阅读全文
摘要:
其实和luogu上主席树的板子差不多,就是把它放到了树上,把板子改成求sum[u]+sum[v] sum[lca] sum[lcafa]的就行了。 cpp include include include include using namespace std; const int N=100005; 阅读全文
摘要:
大意:求树上路径和mod 3 =0 的点对数。 一开始写的容斥无限智障,后来参考了一下题解,发现根本不用我那种垃圾写法。。。 cpp include include include using namespace std; const int N=100005; int n,rt,head[N],e 阅读全文
摘要:
算法流程:找到树的重心,删去这个点,递归子树。 题号luogu3806 cpp include include include include include include using namespace std; const int N=10005; inline int read(){ int 阅读全文
摘要:
性质:每个位置的前缀和必须大于0,总和=0.以此dp即可。 cpp include include include using namespace std; const int mod=1e9+7; int n,m,f[2005][2005],ans,sum,mn=0x3f3f3f3f; char 阅读全文