Qiuqiqiu  
不管道路多么崎岖坎坷,我永远不停下追逐梦想的脚步!

2013年2月14日

摘要: hdu 1384 Intervals http://acm.hdu.edu.cn/showproblem.php?pid=1384 2013-2-14f(b)-f(a)>=c0<=f(x+1)-f(x)<=1View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <vector> 4 #include <queue> 5 using namespace std; 6 7 const int N=50010; 8 struct BellmanFord{ 9 str 阅读全文
posted @ 2013-02-14 11:28 Qiuqiqiu 阅读(113) 评论(0) 推荐(0) 编辑

2013年2月3日

摘要: hdu 3360 National Treasures http://acm.hdu.edu.cn/showproblem.php?pid=3360 2013-2-3最少的保安数=n*m-最多的物品数最多的物品数就是最大独立集 物品的奇偶不同才可能有边 是二分图View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <vector> 4 using namespace std; 5 6 const int N=2600; 7 struct BGMatch{ 8 int n; 9 vector 阅读全文
posted @ 2013-02-03 13:21 Qiuqiqiu 阅读(144) 评论(0) 推荐(0) 编辑

2013年2月2日

摘要: hdu 1814 Peaceful Commission http://acm.hdu.edu.cn/search.php?action=listproblem 2013-2-2View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 #include <vector> 5 using namespace std; 6 7 const int N=8010; 8 struct TwoSAT{ 9 int n;10 vector<int> G[ 阅读全文
posted @ 2013-02-02 22:02 Qiuqiqiu 阅读(186) 评论(0) 推荐(0) 编辑

2013年1月17日

摘要: hdu 2262 Where is the canteen http://acm.hdu.edu.cn/showproblem.php?pid=2262 2013-1-20期望。每个点列出一个方程,高斯消元求解View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 const int N=20; 7 const int dx[]={1,0,-1,0}; 8 const int dy[]={0,1,0,-1}; 9 阅读全文
posted @ 2013-01-17 23:40 Qiuqiqiu 阅读(517) 评论(0) 推荐(0) 编辑
 
摘要: hdu 3949 XOR http://acm.hdu.edu.cn/showproblem.php?pid=3949 2013-1-18给n个数,由这些数异或得到新的数,求第k小的数把所有数看做一个向量空间,先求出向量空间的一个基矩阵中mt(r,c)=a[r]>>(m-1-c) 化为约化阶梯矩阵View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using namespace std; 5 6 typedef long long LL; 7 co 阅读全文
posted @ 2013-01-17 18:36 Qiuqiqiu 阅读(255) 评论(0) 推荐(0) 编辑

2012年12月7日

摘要: hdu 1890 Robotic Sort http://acm.hdu.edu.cn/showproblem.php?pid=1890 2012-12-7区间反转View Code 1 #include <cstdio> 2 #include <algorithm> 3 using namespace std; 4 5 const int N=100010; 6 int num[N],rnk[N],pos[N]; 7 bool cmp(int a,int b) 8 { 9 return num[a]<num[b] || (num[a]==num[b] & 阅读全文
posted @ 2012-12-07 20:40 Qiuqiqiu 阅读(199) 评论(0) 推荐(0) 编辑

2012年11月30日

摘要: hdu 4267 A Simple Problem with Integers http://acm.hdu.edu.cn/showproblem.php?pid=4267多个树状数组,区间跟新,单点询问,转化为单点更新,求和View Code 1 #include <cstdio> 2 #include <cstring> 3 using namespace std; 4 5 const int N=50010; 6 int c[11][10][N]; 7 int a[N]; 8 int lowbit(int x) 9 {10 return x&(-x);11 阅读全文
posted @ 2012-11-30 20:39 Qiuqiqiu 阅读(91) 评论(0) 推荐(0) 编辑
 
摘要: hdu 4366 Successor http://acm.hdu.edu.cn/showproblem.php?pid=4366 2012-12-9题意:给你一棵树,每个节点有能力值(abi)和忠诚值(val),询问一个节点,它的后代中能力值大于它,忠诚值最大的节点遍历树,树状结构转换为线性结构,区间求max(val),abi>k,类似离线算法,先按abi排序,一个一个插入View Code 1 #include <cstdio> 2 #include <vector> 3 #include <cstring> 4 #include <algo 阅读全文
posted @ 2012-11-30 17:22 Qiuqiqiu 阅读(190) 评论(0) 推荐(0) 编辑

2012年11月28日

摘要: hdu 3037 Saving Beans http://acm.hdu.edu.cn/showproblem.php?pid=3037 2012-12-8Lucas 大组合数取模 c(n+m,m)%p p为质数p为质数n=a0*p^0+a1*p^1+...+ak*p^km=b0*p^0+b1*p^1+...+bk*p^kc(n,m)=c(a0,b0)*c(a1,b1)*...*c(ak,bk)inv(x,p)=powmod(x,p-2,p)View Code 1 #include <cstdio> 2 using namespace std; 3 4 typedef long l 阅读全文
posted @ 2012-11-28 22:36 Qiuqiqiu 阅读(156) 评论(0) 推荐(0) 编辑

2012年11月24日

摘要: hdu 4374 One hundred layer http://acm.hdu.edu.cn/showproblem.php?pid=4374 2012-12-3dp[i][j]=max{ max{dp[i-1][k]+sum[j]-sum[k-1]} (j-t<=k<=j), max{dp[i-1][k]+sum[k]-sum[j-1]} (j<=k<=j+k) }View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <algorithm> 4 using n 阅读全文
posted @ 2012-11-24 19:45 Qiuqiqiu 阅读(156) 评论(0) 推荐(0) 编辑