Description FJ's cows really hate getting wet so much that the mere thought of getting caught in the rain makes them shake in their hooves. They have decided to put a rain siren on the farm to let them know when rain is approaching. They intend to cr…
一道水题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个田…
题目要求所有牛都去避雨的最长时间最小. 显然需要二分 二分之后考虑如何判定. 显然每头牛都可以去某个地方 但是前提是最短路径<=mid. 依靠二分出来的东西建图.可以发现这是一个匹配问题 dinic即可. 注意数组要开两倍 因为要拆点 我开小了wa了两发才意识过来. const int MAXN=410; int n,m,S,len,T,L,R,ans; ll a[MAXN][MAXN]; int c[MAXN],cc[MAXN],cur[MAXN],vis[MAXN],q[MAXN]; int…
先预处理出来每个点对之间的最短距离 然后二分答案,网络流判断是否可行就好了恩 /************************************************************** Problem: 1738 User: rausen Language: C++ Result: Accepted Time:404 ms Memory:9788 kb **************************************************************…
题目描述 FJ's cows really hate getting wet so much that the mere thought of getting caught in the rain makes them shake in their hooves. They have decided to put a rain siren on the farm to let them know when rain is approaching. They intend to create a…
二分答案,贪心判定 #include<iostream> #include<cstdio> #include<algorithm> using namespace std; const int N=100005; int n,m,a[N]; int read() { int r=0,f=1; char p=getchar(); while(p>'9'||p<'0') { if(p=='-') f=-1; p=getchar(); } while(p>=…
poj 2391 Ombrophobic Bovines, 最大流, 拆点, 二分 dinic /* * Author: yew1eb * Created Time: 2014年10月31日 星期五 15时39分22秒 * File Name: poj2391.cpp */ #include <ctime> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring&g…
题目 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…
最小最大...又是经典的二分答案做法.. -------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> #include<iostream>   #define rep( i , n ) for( int i = 0 ; i < n ; ++i ) #def…