[USACO12DEC]逃跑的BarnRunning Away From- 题目描述 It's milking time at Farmer John's farm, but the cows have all run away! Farmer John needs to round them all up, and needs your help in the search. FJ's farm is a series of N (1 <= N <= 200,000) pastures nu…
题目传送门 逃跑的Barn 题目描述 It's milking time at Farmer John's farm, but the cows have all run away! Farmer John needs to round them all up, and needs your help in the search. FJ's farm is a series of N (1 <= N <= 200,000) pastures numbered 1...N connected b…
Ralph W. Tyler Anyone who cares about what schools and colleges teach and how their student learn will be interested in the memoir of Ralph W. Tyler who is one of the most famous men in American education. 任何关心学校和大学的教育内容以及学生如何学习的人都会对拉尔夫·泰勒的回忆录感兴趣, 他是…
题面 题目描述 给出以1号点为根的一棵有根树,问每个点的子树中与它距离小于等于l的点有多少个. 输入格式: Line 1: 2 integers, N and L (1 <= N <= 200,000, 1 <= L <= 10^18) Lines 2..N: The ith line contains two integers p_i and l_i. p_i (1 <= p_i < i) is the first pasture on the shortest pa…
题面链接 一句话题意:给出以1号点为根的一棵有根树,问每个点的子树中与它距离小于等于l的点有多少个. 我:似乎并不好做啊...看了题解后大雾... sol:考虑树上差分,对于一个点,在他那个位置++,再找到最远的一个点使得该点与当前点的距离小于等于l,在找到的那个点的父亲处--,至于实现倍增好像可以轻松解决. #include <cstdio> using namespace std; #define int long long ; ],re[N],d[N]; signed main() {…
题目描述It's milking time at Farmer John's farm, but the cows have all run away! Farmer John needs to round them all up, and needs your help in the search. FJ's farm is a series of N (1 <= N <= 200,000) pastures numbered 1...N connected by N - 1 bidirec…