POI2014 FAR-FarmCraft】的更多相关文章

[Poi2014]FarmCraft 题目 mhy住在一棵有n个点的树的1号结点上,每个结点上都有一个妹子. mhy从自己家出发,去给每一个妹子都送一台电脑,每个妹子拿到电脑后就会开始安装zhx牌杀毒软件,第i个妹子安装时间为Ci. 树上的每条边mhy能且仅能走两次,每次耗费1单位时间.mhy送完所有电脑后会回自己家里然后开始装zhx牌杀毒软件. 卸货和装电脑是不需要时间的. 求所有妹子和mhy都装好zhx牌杀毒软件的最短时间. INPUT 第一行输入一个整数N,表示有N个结点 第二行有N个整数…
先贴一波题面... 3829: [Poi2014]FarmCraft Time Limit: 20 Sec  Memory Limit: 128 MBSubmit: 421  Solved: 197[Submit][Status][Discuss] Description In a village called Byteville, there are   houses connected with N-1 roads. For each pair of houses, there is a u…
[BZOJ3829][Poi2014]FarmCraft Description In a village called Byteville, there are   houses connected with N-1 roads. For each pair of houses, there is a unique way to get from one to another. The houses are numbered from 1 to  . The house no. 1 belon…
题目描述 In a village called Byteville, there are   houses connected with N-1 roads. For each pair of houses, there is a unique way to get from one to another. The houses are numbered from 1 to  . The house no. 1 belongs to the village administrator Byte…
题目描述 In a village called Byteville, there are   houses connected with N-1 roads. For each pair of houses, there is a unique way to get from one to another. The houses are numbered from 1 to  . The house no. 1 belongs to the village administrator Byte…
原文地址:http://www.cnblogs.com/GXZlegend/p/6826667.html 题目描述 In a village called Byteville, there are   houses connected with N-1 roads. For each pair of houses, there is a unique way to get from one to another. The houses are numbered from 1 to  . The…
题目 In a village called Byteville, there are houses connected with N-1 roads. For each pair of houses, there is a unique way to get from one to another. The houses are numbered from 1 to . The house no. 1 belongs to the village administrator Byteasar.…
d[x]表示走完x的子树并回到x所需的时间 f[x]表示从走到x开始计时,x子树中最晚的点安装完的最早时间 d[x]=sum(d[i]+2),i是x的孩子 f[x]的计算比较复杂: 考虑将x的各棵子树按一定顺序排列,第i个走的子树是u,则它的贡献为sum(d[j]+2)+f[u]+1,j<i 即我们需要最小化max(sum(d[j]+2)+f[u]),设s[i]表示sum(d[j]+2),j<=i 对于序列中的两棵相邻子树i,j(i<j),交换它们只会影响它们两个的f[] 如果不交换比交…
对于每个点,处理出走完其子树所需要的时间和其子树完全下载完软件的时间 易证,对于每个点的所有子节点,一定优先选择差值大的来给后面的时间 树规+贪心. #include<cstdio> #include<cstring> #include<iostream> #include<cmath> #include<algorithm> #include<queue> #define N 500005 using namespace std;…
题目链接 BZOJ3829 题解 设\(f[i]\)为从\(i\)父亲进入\(i\)之前开始计时,\(i\)的子树中最晚装好的时间 同时记\(siz[i]\)为节点\(i\)子树大小的两倍,即为从父亲进入并回到父亲的时间 那么有 \[f[i] = max\{C[i],f[to] + siz_{pre}\} + 1\] 我们只需给出一个合理的访问子树的顺序,以最小化\(f[i]\)的值 我们先考虑最后访问的一棵子树,记\(sum = \sum siz[to]\) 那么最后一棵子树的贡献 \[f[t…