摘要:
参考网上大牛的方法做的,A了,但做法的可行性我还没有想明白。慢慢再想吧,先贴代码~/* * hdu1569/win.cpp * Created on: 2011-10-5 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>#include <iostream>#include <queue>using namespace std;typedef int 阅读全文
摘要:
一看就是网络流,直接上Dinic模板,交上,RE,把MAXM改成500,过了,对出题者无语!/* * hdu1532/win.cpp * Created on: 2011-10-5 * Author : ben */#include <cstdio>#include <cstdlib>#include <cstring>#include <cmath>#include <algorithm>#include <iostream>#include <queue>using namespace std;typede 阅读全文
摘要:
这题可以用最大流做,为了练DP就用状态压缩了。我一开始只想到一个O(n*2^n*2^n)的方法,效率太低,看了某大牛的解题报告后,才将算法优化到O(n^2*2^n)。不过就这样还WA了好几次,原因是代码中一句if ((k & t) == 0)我开始写成了if (k & t == 0)没有注意到位运算符的优先级是低于逻辑运算符的,谨记谨记!/* * hdu1565/win.cpp * Created on: 2011-10-4 * Author : ben */#include <cstdio>#include <cstdlib>#include < 阅读全文