摘要:
"传送门" 题意: 给出一颗边权为正数的树,问有多少点对之间的距离小于等于$k$。 思路: 点分治模板题,对于一个子问题,$dfs$出所有的距离之后,排个序可以用双指针,或者直接二分也行,复杂度都为$O(nlogn^2)$。 cpp include using namespace std; type 阅读全文
摘要:
"传送门" A. The beautiful values of the palace 题意: 给出一个$n n$的矩阵,并满足$n$为奇数,矩阵中的数从右上角开始往下,类似于蛇形填数那样来填充。 之后会给出$m$个有效数字的坐标,坐标左下角为$(1,1)$,右上角为$(n,n)$,其余数字都为$0 阅读全文
摘要:
"传送门" A.There Are Two Types Of Burgers 签到。 B.Square Filling 签到 C.Gas Pipeline 每个位置只有“高、低”两种状态,所以直接根据条件来$dp$即可。 Code cpp include define MP make_pair de 阅读全文