题目链接http://www.codeforces.com/contest/11/problem/D题目的点数不超过20,所以利用状态压缩DP可解dp[i][j]表示i状态时以j结尾的简单路径的数量,i的二进制表示中为1的表示这个点在路径中i的二进制中最低位1表示的点是起始点View Code #include<cstdio>#include<cstring>typedef __int64 lld;const int maxn = 19;lld dp[1<<maxn][maxn];//int mp[maxn][maxn];int main(){ int n, Read More
posted @ 2012-04-05 23:34 Because Of You Views(633) Comments(0) Diggs(0) Edit
求出所有的交点,去重,如果是警察点,就不放入点集再把不在线段交点上的警察点加入点集,排序由于一个点只能和同一线段上相邻的点连边,所以枚举每条直线,相邻的点如果不是警察,建边最后bfs判断能否搜到即可View Code #include <math.h>#include <cstdio>#include <vector>#include <queue>#include<algorithm>using namespace std;const int maxn = 10001;const double eps = 1e-8;inline d Read More
posted @ 2012-04-05 23:26 Because Of You Views(469) Comments(0) Diggs(0) Edit