There is a rooted tree with n nodes, number from 1-n. Root’s number is 1.Each node has a value ai. Initially all the node’s value is 0. We have q operations. There are two kinds of operations. 1 v x k : a[v]+=x , a[v’]+=x-k (v’ is child of v) , a[v’’
Network of Schools Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 15211 Accepted: 6040 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a li
Network of Schools Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13804 Accepted: 5507 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a li
Network of Schools A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a list of schools to which it distributes software (the “receiving schools”). Note that if B is in t
Network of Schools Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 13325 Accepted: 5328 Description A number of schools are connected to a computer network. Agreements have been developed among those schools: each school maintains a li
Popular Cows Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 35035 Accepted: 14278 Description Every cow's dream is to become the most popular cow in the herd. In a herd of N (1 <= N <= 10,000) cows, you are given up to M (1 <= M &