摘要:
#include<stdio.h> #include<algorithm> #include<iostream> using namespace std; const int maxn=1e4+5; const int inf=0x3f3f3f3f; struct edge{ int v, next 阅读全文
posted @ 2020-02-13 16:18
aaaaaaaaaaaaaa123
阅读(148)
评论(0)
推荐(0)
摘要:
已知完全二叉树和每条边的权值,q次询问,每次给出sta起点和H。 w=(H-点到sta的权值),求w>0的所有w的加和。 这题用树上前缀和来写,e[i]记录子树上的点到点i的距离,sum[i][j]为e[i]的前缀和 这样每次找到满足大于h-len[i]的长度就行(二分查找) void init() 阅读全文
posted @ 2020-02-13 16:16
aaaaaaaaaaaaaa123
阅读(135)
评论(0)
推荐(0)
摘要:
想得到链状排序,并且知道几段(可能重复)的排序方式时。 (1)排除一对多,多对一的情况(in和out) (2)排除环状(排序完一次后,看是否还剩元素没有用) 阅读全文
posted @ 2020-02-13 16:08
aaaaaaaaaaaaaa123
阅读(130)
评论(0)
推荐(0)

浙公网安备 33010602011771号