Home > Database > Mysql Tutorial > POJ 3189 图论技巧题

POJ 3189 图论技巧题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 15:42:14
Original
1018 people have browsed it

这题的技巧就是:枚举---旋转卡壳法。 题目大意: 每头牛对每个谷仓有一个喜欢程度,FJ的目的就是要使得每头牛的happy尽可能的相同,求最小的范围。 这题的枚举还是很有技巧的。虽然知道怎么来滑动窗口。。 但是我的网络流EK算法太不给力了! 没办法.. 去学

这题的技巧就是:枚举---旋转卡壳法。

题目大意:

每头牛对每个谷仓有一个喜欢程度,FJ的目的就是要使得每头牛的happy值尽可能的相同,求最小的范围。

这题的枚举还是很有技巧的。虽然知道怎么来滑动窗口。。 但是我的网络流EK算法太不给力了!

没办法.. 去学习了下SAP勉强把这题切掉了= =

#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#define MN 1111
#define INF 0x0FFFFFFF
#define CC(m,what)		memset(m,what,sizeof(m))
#define FOR(i,a,b)		for( int i = (a) ; i = 0 ; i --)
#define SS(a)			scanf("%d",&a)
#define LL(a)			((a) inline T countbit(T n)	{return n?1+countbit(n&(n-1)):0;}
template<class t> inline T sqr(T a)	{return a*a;}
template<class t> inline void checkmin(T &a,T b)	{if(a == -1 || a > b)a = b;}
template<class t> inline void checkmax(T &a,T b)	{if(a dis[v] )
		{
			cur[u]=v;
			mind=dis[v];
		}
		if( (--gap[dis[u]])==0 ) break;
		gap[dis[u]=mind+1]++;
		u=pre[u];
	}
	return maxflow;
}

bool work()
{
 	 int i,j;
	 if( sap()==N ) return true;
	 else return false;
}

int main()
{
 	while( scanf("%d%d",&N,&B)!=EOF )
 	{
	 	   setG();
	 	   int range=INF;
	 	   int r=1,l=1;
	 	   while( l<br>
<br>



</class></class></class></algorithm></cstdio></string></iostream>
Copy after login
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template