Qiuqiqiu  
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步!
上一页 1 2 3 4 5 6 7 ··· 20 下一页

2012年7月9日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3920View Code 1 #include <cstdio> 2 #include <cmath> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 7 double d[1100000]; 8 bool vis[1100000]; 9 int n;10 struct point11 {12 double x,y;13 void input()14 {15 scanf(& 阅读全文
posted @ 2012-07-09 20:23 Qiuqiqiu 阅读(146) 评论(0) 推荐(0) 编辑

2012年7月3日

摘要: 并查集View Code 1 #include <cstdio> 2 #include <algorithm> 3 #include <cstring> 4 using namespace std; 5 6 const int N=20010; 7 int set[N],key[N],n; 8 int find(int x) 9 {10 if(x==set[x]) return x;11 int t=find(set[x]);12 key[x]^=key[set[x]];13 return set[x]=t;14 }15 bool merge(int x,i 阅读全文
posted @ 2012-07-03 13:09 Qiuqiqiu 阅读(351) 评论(0) 推荐(0) 编辑

2012年7月1日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3265面积并。线段树+扫描线,坐标为小于50000的int型,所以没必要离散化View Code 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 5 typedef __int64 LL; 6 const int N=50010*4; 7 struct segment 8 { 9 int x1,x2,y;10 int d;11 segment(){}12 segment(int _x1,... 阅读全文
posted @ 2012-07-01 21:35 Qiuqiqiu 阅读(205) 评论(0) 推荐(0) 编辑

2012年6月27日

摘要: 并查集up记录x上面的个数,sum记录总数View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=30010; 6 int set[N],up[N],sum[N]; 7 int find(int x) 8 { 9 if(x==set[x]) return x;10 int t=find(set[x]);11 up[x]+=up[set[x]];12 return set[x]=t;13 }14 int main()15 {16 ... 阅读全文
posted @ 2012-06-27 11:14 Qiuqiqiu 阅读(196) 评论(1) 推荐(0) 编辑

2012年6月18日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1007求最近两个点的距离《算法导论》p591的分治算法 O(nlogn)再改造下《算法竞赛入门经典》p143 归并排序的代码 1 #include <cstdio> 2 #include <cmath> 3 #include <algorithm> 4 using namespace std; 5 6 const double eps=1e-8; 7 int dcmp(double x) 8 { 9 return x<-eps?-1:x>eps;10 }11 s 阅读全文
posted @ 2012-06-18 10:26 Qiuqiqiu 阅读(192) 评论(0) 推荐(0) 编辑

2012年5月20日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2768二分图匹配最大独立集=节点数-最大匹配数View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=510; 6 struct vote 7 { 8 char l[5],h[5]; 9 }v[N];10 int g[N][N],n;11 int mat[N];12 bool vis[N];13 bool ok(int i,int j)14 {15 return 阅读全文
posted @ 2012-05-20 18:32 Qiuqiqiu 阅读(268) 评论(0) 推荐(0) 编辑

2012年5月19日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1507二分图匹配View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=110; 6 const int dx[4]={0,1,0,-1}; 7 const int dy[4]={1,0,-1,0}; 8 int mz[N][N],n,m; 9 int mat[N][N],vis[N][N];10 int f(int x,int y)11 {12 return ( 阅读全文
posted @ 2012-05-19 21:46 Qiuqiqiu 阅读(238) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1054View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=1510,M=3010; 6 struct edge 7 { 8 int v,next; 9 }e[M];10 int head[N],n,m;11 bool vis[N];12 int mat[N];13 void graphinit()14 {15 memset(head,-1,sizeof(hea 阅读全文
posted @ 2012-05-19 11:06 Qiuqiqiu 阅读(155) 评论(0) 推荐(0) 编辑

2012年5月17日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3191dijkstra求次短路View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=60; 6 int g[N][N],n,m; 7 int dis[N][2],cnt[N][2]; 8 bool vis[N][2]; 9 void dijkstra(int p)10 {11 memset(vis,0,sizeof(vis));12 memset(cnt,0,s 阅读全文
posted @ 2012-05-17 17:47 Qiuqiqiu 阅读(241) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2377对所有公交车站点求最短路View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 #include <algorithm> 5 using namespace std; 6 7 const int N=10010,M=200010; 8 struct edge 9 {10 int v,w,next;11 }e[M];12 int head[N],n,m,t;13 bool 阅读全文
posted @ 2012-05-17 13:39 Qiuqiqiu 阅读(277) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 20 下一页