Description A crime has been comitted: a load of grain has been taken from the barn by one of FJ's cows. FJ is trying to determine which of his C (1 <= C <= 100) cows is the culprit. Fortunately, a passing satellite took an image of his farm M (1 &l…
http://www.lydsy.com/JudgeOnline/problem.php?id=1681 太裸了.. #include <cstdio> #include <cstring> #include <cmath> #include <string> #include <iostream> #include <algorithm> #include <queue> using namespace std; #de…
Description A crime has been comitted: a load of grain has been taken from the barn by one of FJ's cows. FJ is trying to determine which of his C (1 <= C <= 100) cows is the culprit. Fortunately, a passing satellite took an image of his farm M (1 &l…
题目 1739: [Usaco2005 mar]Space Elevator 太空电梯 Time Limit: 5 Sec  Memory Limit: 64 MB Description The cows are going to space! They plan to achieve orbit by building a sort of space elevator: a giant tower of blocks. They have K (1 <= K <= 400) differe…
一道水题WA了这么多次真是.... 统考终于完 ( 挂 ) 了...可以好好写题了... 先floyd跑出各个点的最短路 , 然后二分答案 m , 再建图. 每个 farm 拆成一个 cow 点和一个 shelter 点, 然后对于每个 farm x : S -> cow( x ) = cow( x ) 数量 , shelter( x ) -> T = shelter( x ) 容量 ; 对于每个dist( u , v ) <= m 的 cow( u ) -> shelter( v…
Description 约翰的牛们非常害怕淋雨,那会使他们瑟瑟发抖.他们打算安装一个下雨报警器,并且安排了一个撤退计划.他们需要计算最少的让所有牛进入雨棚的时间.    牛们在农场的F(1≤F≤200)个田地上吃草.有P(1≤P≤1500)条双向路连接着这些田地.路很宽,无限量的牛可以通过.田地上有雨棚,雨棚有一定的容量,牛们可以瞬间从这块田地进入这块田地上的雨棚    请计算最少的时间,让每只牛都进入雨棚. Input 第1行:两个整数F和P; 第2到F+1行:第i+l行有两个整数描述第i个田…
Description 牛们干草要用完了!贝茜打算去勘查灾情. 有N(2≤N≤2000)个农场,M(≤M≤10000)条双向道路连接着它们,长度不超过10^9.每一个农场均与农场1连通.贝茜要走遍每一个农场.她每走一单位长的路,就要消耗一单位的水.从一个农场走到另一个农场,她就要带上数量上等于路长的水.请帮她确定最小的水箱容量.也就是说,确定某一种方案,使走遍所有农场通过的最长道路的长度最小,必要时她可以走回头路. Input 第1行输入两个整数N和M;接下来M行,每行输入三个整数,表示一条道路…
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1680 题意: 在接下来的n周内,第i周生产一吨酸奶的成本为c[i],订单为y[i]吨酸奶. 酸奶可以提前生产,可以存放无限长的时间,存放一周的花费为s. 问你在完成所有订单的前提下,最小的花费为多少. 题解: 贪心. p[i]代表第i周的最小成本. 对于p[i],只用考虑p[i-1],因为已经保证了p[i-1]是i-1之前所有周的最优答案. 所以转移为:p[i] = min(c[i],…
贪心,一边读入一边更新mn,用mn更新答案,mn每次加s #include<iostream> #include<cstdio> using namespace std; int n,s,mn=1e9; long long ans; int main() { scanf("%d%d",&n,&s); for(int i=1,w,c;i<=n;i++) { scanf("%d%d",&w,&c); mn+=…
二分答案,把边权小于mid的边的两端点都并起来,看最后是否只剩一个联通块 #include<iostream> #include<cstdio> using namespace std; const int N=2005; int n,m,f[N]; struct qwe { int u,v,w; }a[N*5]; int read() { int r=0,f=1; char p=getchar(); while(p>'9'||p<'0') { if(p=='-') f…