摘要: 在计算答案的时候维护一个数组num num[i]为当前所有点距离根距离%3的数量 则当前块的答案为num[0]*num[0]+2*num[1]*num[2] #include<bits/stdc++.h> #include<cstdio> #include<cstring> #include<alg 阅读全文
posted @ 2019-03-05 19:10 Aragaki 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 询问树上距离为k的点对是否存在 直接n^2暴力处理点对 桶排记录 可以过 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; const int MAXN = 1e5 + 5; const int M 阅读全文
posted @ 2019-03-05 13:18 Aragaki 阅读(245) 评论(0) 推荐(0) 编辑