LA3902 Networlk】的更多相关文章

Network Consider a tree network with n nodes where the internal nodes correspond to servers and the terminal nodes correspond to clients. The nodes are numbered from 1 to n. Among the servers, there is an original server S which provides VOD (Video O…
给出一棵树,对于每一个叶子节点要使得在它的k距离内至少一个节点被打了标记,(叶节点不能打标记,非叶结点也不必满足这个条件),现在已经有一个节点s被打了标记,问至少还要打几个标记(这表达能力也是捉急...自己懂就算了...) #include<iostream> #include<cstring> #include<cstdio> #include<vector> using namespace std; ; vector<int> G[maxn]…
题目链接:点击打开链接 题意:n台机器连成一个树状网络,其中叶节点是客户端,其他节点是服务器,目前有一台服务器s正在提供服务.让你在其他服务器上也安排同样的服务,使得每台客户端到最近服务器的距离不超过k,而且要使服务器尽量少,问最少要设置多少台服务器. 思路:我们先把s看做根节点,做一遍dfs,把离s距离小于等于k的叶子节点标为访问过,表示这个叶子节点已经得到服务了,然后再把没有访问过的叶子节点按深度从大到小排序,每次找到深度最大的点,在它的k倍祖先上放服务器,然后dfs一遍,把离它距离不超过k…
题意:      给你一棵树,所有叶子节点都是客户端,其他的都是服务器,然后问你最少在多少个服务器上安装VOD能使所有的客户端都能流畅的看视频,流畅看视频的条件是每个客户端距离他最近的安装VOD的服务器的距离不能超过k,而且题目已经给你在一个服务器上安装好了VOD. 思路:      自己没想出来,说下白书上的思路,第一个就是说当遇到无根树的时候,一般情况下把无根树变成有根数会有利于问题的解决,然后这个题目就是把给定的VOD服务器变成了树根,然后我们可以根据贪心策略,先处理深度最深的,安装VOD…
UVALive - 3902 Network Consider a tree network with n nodes where the internal nodes correspond to servers and the terminal nodes correspond to clients. The nodes are numbered from 1 to n. Among the servers, there is an original server S which provid…
重要意义:复习好久没写的邻接表了. Network, Seoul 2007, LA3902 Consider a tree network with n nodes where the internal nodes correspond to servers and the terminal nodes correspond to clients. The nodes are numbered from 1 to n . Among the servers, there is an origin…