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

2012年5月14日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2962二分+spfaView Code 1 #include <cstdio> 2 #include <cstring> 3 #include <queue> 4 using namespace std; 5 6 const int N=1010,M=200010; 7 struct edge 8 { 9 int v,w,h,next;10 }e[M];11 int head[N],n,m;12 bool inq[N];13 int dis[N];14 queue<i 阅读全文
posted @ 2012-05-14 23:13 Qiuqiqiu 阅读(199) 评论(0) 推荐(0) 编辑

2012年5月13日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2923map+floyd#include <cstdio>#include <cstring>#include <cctype>#include <map>#include <string>using namespace std;const int N=110,INF=1000010;int n,m,sz;int g[N][N];int q[1010];map<string,int> mp;void floyd(){ for(int k= 阅读全文
posted @ 2012-05-13 18:03 Qiuqiqiu 阅读(203) 评论(0) 推荐(0) 编辑

2012年5月8日

摘要: 树状数组View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 typedef __int64 LL; 7 const int N=100010; 8 struct node 9 {10 int nx,nh,x,h;11 bool operator < (const node &a)const12 {13 return nh<a.nh;14 }15 }a[N];16 LL c1[N];17 in 阅读全文
posted @ 2012-05-08 19:09 Qiuqiqiu 阅读(288) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3486RMQ知道二分是错的,写了个加简单优化的枚举还是超时,只能用错误的二分做这题主要为了学习RMQ,别的细节就不管了View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 const int N=200010, A=1001; 7 int a[N]; 8 int n,k; 9 int st[N][20],lg2[N];10 vo 阅读全文
posted @ 2012-05-08 17:05 Qiuqiqiu 阅读(450) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2874LCA Tarjan算法#include <cstdio>#include <cstring>#include <vector>using namespace std;const int N=10010,M=20010;struct edge{ int v,w,next;}e[M];int em;int head[N],n;struct qes{ int v,k;};vector<qes> q[N];int dis[N],vis[N],set[N],anc 阅读全文
posted @ 2012-05-08 09:50 Qiuqiqiu 阅读(318) 评论(0) 推荐(0) 编辑

2012年5月4日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3518后缀数组View Code 1 //3518 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 6 int Max(int x,int y) {return x>y?x:y;} 7 int Min(int x,int y) {return x<y?x:y;} 8 const int L=1010; 9 char str[L];10 int r[L],wa[L],wb[L],ws[L];1 阅读全文
posted @ 2012-05-04 09:30 Qiuqiqiu 阅读(285) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1892二维树状数组View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=1010,maxn=1001; 6 int a[N][N],c[N][N]; 7 int lowbit(int x) 8 { 9 return x&(-x);10 }11 void add(int x,int px,int py,int maxn)12 {13 for(int i=p 阅读全文
posted @ 2012-05-04 09:28 Qiuqiqiu 阅读(161) 评论(0) 推荐(0) 编辑

2012年5月2日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1053哈夫曼树View Code 1 //1053 2 #include <cstdio> 3 #include <cstring> 4 #include <queue> 5 using namespace std; 6 7 const int L=10000,N=60; 8 char str[L]; 9 int c[30];10 int lch[N],rch[N],w[N],sz;11 typedef pair<int,int> pii;12 priority 阅读全文
posted @ 2012-05-02 23:31 Qiuqiqiu 阅读(306) 评论(0) 推荐(0) 编辑

2012年4月30日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3231很巧妙地将问题转化为拓扑排序View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=2010; 6 bool g[3][N][N]; 7 int ind[3][N],n; 8 int topo[3][N]; 9 int x[N],y[N],z[N];10 bool toposort(int k)11 {12 memset(ind[k],0,sizeof(in 阅读全文
posted @ 2012-04-30 14:35 Qiuqiqiu 阅读(506) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3357View Code 1 //3357 2 #include <cstdio> 3 #include <cstring> 4 using namespace std; 5 6 const int N=250; 7 int g[N][N]; 8 int main() 9 {10 int n,m,C=0;11 while(scanf("%d%d",&n,&m),n||m)12 {13 memset(g,0,sizeof(g));14 for(int 阅读全文
posted @ 2012-04-30 10:48 Qiuqiqiu 阅读(170) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 ··· 20 下一页