Given a weighted graph with n nodes and m edges. for each node v we should calculate number of nodes u such that d(v,u)<=k . n,m<=5e4 k<=100; Please somebody help me. UPD: I don't know if it's important or not but Wi<=100 for every edge.
Given a weighted graph with n nodes and m edges. for each node v we should calculate number of nodes u such that d(v,u)<=k . n,m<=5e4 k<=100; Please somebody help me. UPD: I don't know if it's important or not but Wi<=100 for every edge.
You're given a tree with n vertices.Your task is to calculate number of ways to give the ith edge of tree an integer number from interval [li,ri] such that sum of the numbers of all paths do not exceed k.output answer modulo 1e9+7.1<=li<=ri<=1e5 1<=n,k<=1e5 I really have no idea to solve this, please help me.