博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2012年7月11日

摘要: 题目:http://acm.uestc.edu.cn/problem.php?pid=1709View Code #include <stdio.h>#include <string.h>#include <iostream>#define ll long longusing namespace std;const int N = 50000+10;int M;ll a[N], n, dp[N], m;ll get_and(int y){ ll ans = 0; dp[0]=0; for (int i=1; i<=n; i++){ if ((a[i]& 阅读全文

posted @ 2012-07-11 18:32 紫华弦筝 阅读(164) 评论(0) 推荐(0) 编辑

2012年7月8日

摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=1890伸展树,按照题意模拟,把所求第i个节点旋转至根节点,reverse一下View Code #include <iostream>#include <cstdio>#include <cstring>#include <algorithm>#define keytree root->ch[1]->ch[0]using namespace std;const int M = 100000+10;const int inf = 0x3f3f3f 阅读全文

posted @ 2012-07-08 21:19 紫华弦筝 阅读(149) 评论(0) 推荐(0) 编辑

2012年6月28日

摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=4003View Code #include <stdio.h>#include <string.h>#include <algorithm>#define clr(a,b) memset(a,b,sizeof(a))using namespace std;const int N = 10000+10;const int M = 20000+10;int n, e, s, k;int he[N];int ev[M], ew[M], nxt[M];int dp[N][11 阅读全文

posted @ 2012-06-28 21:40 紫华弦筝 阅读(130) 评论(0) 推荐(0) 编辑

2012年5月12日

摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=3480View Code #include <stdio.h>#include <string.h>#include <math.h>#include <algorithm>#define ll long long#define clr(a,b) memset(a, b, sizeof(a))using namespace std;const int N = 10000+10;const int M = 10000+10;const int inf = 0 阅读全文

posted @ 2012-05-12 22:17 紫华弦筝 阅读(162) 评论(0) 推荐(0) 编辑

摘要: 题目:http://acm.hust.edu.cn:8080/judge/problem/viewProblem.action?id=16331View Code #include <stdio.h>#include <string.h>#include <math.h>#include <algorithm>#define ll long long#define clr(a,b) memset(a, b, sizeof(a))using namespace std;const int N = 50000+10;const int M = 100 阅读全文

posted @ 2012-05-12 18:12 紫华弦筝 阅读(194) 评论(0) 推荐(0) 编辑

摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=3045View Code #include <stdio.h>#include <string.h>#include <math.h>#include <algorithm>#define ll __int64#define clr(a,b) memset(a, b, sizeof(a))using namespace std;const int N = 500000+10;const int M = 10000+10;const int inf = 0x 阅读全文

posted @ 2012-05-12 15:53 紫华弦筝 阅读(141) 评论(0) 推荐(0) 编辑

2012年4月30日

摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=2993一个细节没注意,导致WA了无数遍,不过也让我对斜率优化有了更深的认识,要维护“队列里”的数据的凸性。View Code #include <iostream>#include <stdio.h>#include <string.h>#include <algorithm>using namespace std;const int N = 100000+10;int n, m, l, r, k;int q[N];double a[N];char ch 阅读全文

posted @ 2012-04-30 22:45 紫华弦筝 阅读(248) 评论(0) 推荐(0) 编辑

2012年4月6日

摘要: 题目:http://poj.org/problem?id=2553题意:一张有向图G,G图中从v可达的所有点w,也都可以达到v,这样的v称为sink。按照大小全部输出,没有输出空行。方法:tarjanView Code #include <stdio.h>#include <string.h>#include <math.h>#include <algorithm>#define Max(A,B) ((A)>(B)?(A):(B))#define Min(A,B) ((A)<(B)?(A):(B))#define clr(a,b) m 阅读全文

posted @ 2012-04-06 15:47 紫华弦筝 阅读(115) 评论(0) 推荐(0) 编辑

摘要: 题目:http://poj.org/problem?id=2186题意:给一张有向图,求一些点的个数,这些点满足其他所有点都能直接或间接指向它。方法:tarjan+缩点View Code #include <stdio.h>#include <string.h>#include <math.h>#include <algorithm>#define Max(A,B) ((A)>(B)?(A):(B))#define Min(A,B) ((A)<(B)?(A):(B))#define clr(a,b) memset(a, b, size 阅读全文

posted @ 2012-04-06 14:34 紫华弦筝 阅读(101) 评论(0) 推荐(0) 编辑

2012年2月15日

摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=2203给定两个字符串s1和s2,如果能通过s1循环移位,使s2包含在s1中,那么我们就说s2 是s1的亲和串。View Code #include <iostream>#include <cstdio>#include <cstring>using namespace std;const int MAXV = 200000+10;void kmp(char in[], int len, int path[]){ int i, j = -1; path[0] = -1; 阅读全文

posted @ 2012-02-15 20:54 紫华弦筝 阅读(145) 评论(0) 推荐(0) 编辑