摘要: http://poj.org/problem?id=3264RMQ讲解http://dongxicheng.org/structure/lca-rmq/j = log2Kdp[i][j] = max(dp[i][j-1]+dp[i+(1 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 #define N 50005 9 int minz[N][40],maxz[N][40];10 void init(int n)11 {12 int i,j,o = floor(log10(d... 阅读全文
posted @ 2013-08-14 21:24 _雨 阅读(200) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2852区间K值写错了。。。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define N 100010 8 #define lowbit(x) (x&(-x)) 9 int s[N>1;18 if(p>m)19 add(p,da,m+1,r,w=r)27 return s[w];28 int m = (l+r)>>1,ans=0;29 if(am... 阅读全文
posted @ 2013-08-14 19:42 _雨 阅读(231) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4669这题各种错误都来了一遍 预处理一下第一个数作为尾数与相邻前面的数组成的数的余数 然后再与后面的结合求余数9 6 4 2 8 因为是个环 可以 9 6 4 2 8 9 6 4 2 8 组合 不过 又不能超N所以先预处理 89 289 4289 64289 的余数 再与后面的组合 删除重复的 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define N 50005 7 #define LL __int64 8 . 阅读全文
posted @ 2013-08-14 17:03 _雨 阅读(199) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4632TLE了N次 原因居然是取模次数太多了。。! 这数据卡的好紧 还是我写的太搓。。828ms挤过s[i]==s[j]dp[i][j] = dp[i][j-1]+dp[i+1][j]+1;else dp[i][j] = dp[i][j-1]+d[[i+1][j]-dp[i+1][j-1]; 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 #define mod 10007 7 char s[1010]; 8 int . 阅读全文
posted @ 2013-08-14 14:06 _雨 阅读(252) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4671这个高端的题意啊 看了N久啊n>m时 直接第一列按顺序来 第二列为M+1else 第一列顺序来 第二列 按第一组为N 第二组为N-1 依次分配 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define N 110 8 int f[110][110],a[110][110],x[110]; 9 int main()10 {11 int i,j,k,n,m;12 while... 阅读全文
posted @ 2013-08-14 10:39 _雨 阅读(195) 评论(0) 推荐(0) 编辑
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4666先看一个求曼哈顿的帖子http://www.cnblogs.com/lmnx/articles/2479747.html然后用mulityset进行维护下就可以了 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 using namespace std; 8 #define N 60010 9 int w[N][10];10 int main()11 {12 int i,j,q,g,k;13 whil... 阅读全文
posted @ 2013-08-14 10:02 _雨 阅读(197) 评论(0) 推荐(0) 编辑