题面: A. Taming the Herd Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 256 megabytes Early in the morning, Farmer John woke up to the sound of splintering wood. It was the cows, and they were breaking out of…
注意到目录是一颗树结构,然后就简单了,预以1为根的处理出dis[u]为以这个点为根,到子树内的目录总长,si为子树内叶子数 第二遍dfs换根即可 #include<iostream> #include<cstdio> #include<cstring> using namespace std; const int N=100005; int n,h[N],cnt,tot,si[N],de[N],l[N]; long long f[N],mn,dis[N]; bool v…
F - 最大子矩形 Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit Status Description Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located withi…
C. Coloring Trees time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output ZS the Coder and Chris the Baboon has arrived at Udayland! They walked in the park where ntrees grow. They decided to be n…