3479: [Usaco2014 Mar]Watering the Fields Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 81  Solved: 42[Submit][Status] Description Due to a lack of rain, Farmer John wants to build an irrigation system to send water between his N fields (1 <= N <=…
MST...一开始没注意-1结果就WA了... ---------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<vector> #include<cmath> #include<algorithm> #include<iostream>   #define r…
3479: [Usaco2014 Mar]Watering the Fields Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 174  Solved: 97[Submit][Status][Discuss] Description Due to a lack of rain, Farmer John wants to build an irrigation system to send water between his N fields (1…
http://www.lydsy.com/JudgeOnline/problem.php?id=3479 这个还用说吗.... #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <iostream> #include <algorithm> #include <queue> using namespace std…
这个= =最近刷的都是水题啊QAQ 排除掉不可能的边然后就最小生成树就行了= = CODE: #include<cstdio>#include<iostream>#include<cstring>#include<algorithm>using namespace std;#define maxn 2010struct edges{ int x,y,c;}edge[maxn*maxn];int l,x[maxn],y[maxn],n,c,ans,sum,f[…
BZOJ_3479_[Usaco2014 Mar]Watering the Fields_Prim Description Due to a lack of rain, Farmer John wants to build an irrigation system to send water between his N fields (1 <= N <= 2000). Each field i is described by a distinct point (xi, yi) in the 2…
先二分答案m, 然后对于原序列 A[i] = A[i] - m,  然后O(n)找最大连续子序列和, 那么此时序列由 L + mx + R组成. L + mx + R = sum - n * m, sum为原序列的和. 假如二分的答案m是可行的, 那么 L + R = sum - n * m - mx 应该 <= 0 ------------------------------------------------------------------------------------- #inc…
BZOJ_3477_[Usaco2014 Mar]Sabotage_二分答案 题意: 约翰的牧场里有 N 台机器,第 i 台机器的工作能力为 Ai.保罗阴谋破坏一些机器,使得约翰的工作效率变低.保罗可以任意选取一段编号连续的机器,使它们停止工作.但这样的破次,而且保罗无法破坏第一台或最后一台机器.请问他该破坏哪些机器才能让剩下机器的工作效率的平均数最小?为了显示存在感,保罗至少必须破坏一台机器. 分析: 二分出答案k,将a[i]-k,求出2到n-1最大子段和mx.用sum-mx既是剩下的前一段后…
P2212 [USACO14MAR]浇地Watering the Fields 题目描述 Due to a lack of rain, Farmer John wants to build an irrigation system to send water between his N fields (1 <= N <= 2000). Each field i is described by a distinct point (xi, yi) in the 2D plane, with 0 &…
Watering the Fields 时间限制: 1 Sec  内存限制: 64 MB提交: 26  解决: 10[提交][状态][讨论版] 题目描述 Due to a lack of rain, Farmer John wants to build an irrigation system to send water between his N fields (1 <= N <= 2000). Each field i is described by a distinct point (x…