摘要: 题解:现在写起旋转卡壳一气呵成~枚举凸包上每个点i,然后顺时针逐个扫描整个凸包上的点p1,在此同时维护两个指针p2,p3,分别表示在i和p1连线两侧的离这条线最远的点,发现p2,p3是单调的~总时间复杂度n^2的~View Code 1 #include <cstdio> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cmath> 5 #include <iostream> 6 #include <algorithm> 7 8 #define N 2222 9 阅读全文
posted @ 2013-03-05 21:39 proverbs 阅读(1556) 评论(3) 推荐(0) 编辑
摘要: 数据范围果断小,果断暴力。。。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <algorithm> 6 #include <cmath> 7 8 #define N 14 9 #define INF 1e910 11 using namespace std;12 13 int a,b,n;14 double sm[N][N],map[N][N],dp[N][N] 阅读全文
posted @ 2013-03-05 21:34 proverbs 阅读(549) 评论(0) 推荐(0) 编辑
摘要: 题解:刚睡醒写的,总是看不清括号。。。调了半天。。就是横向一个掉队列,纵向b个单调队列,n^2的求出以(i,j)点为右下角的n*n矩形的最大值和最小值,然后n^2的统计就好~View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cstdio> 5 #include <algorithm> 6 7 #define N 1111 8 #define BUG system("pause") 9 10 us 阅读全文
posted @ 2013-03-05 21:33 proverbs 阅读(1010) 评论(0) 推荐(0) 编辑
摘要: 真是很好的计算几何题啊!~转化为二维问题,第三维可以由前两维确定,所以可以不用管。然后两种原料能配成的产品一定在两个点的线段上。转化成在m个点里找最少点,使其完全包含那n个点。floyd最小环。。PS:网上的貌似都是错了。。2 10 0 10 0.5 0.50 1 0答案:-1细节啊!!!View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <algorithm> 6 #inclu 阅读全文
posted @ 2013-03-05 21:29 proverbs 阅读(1095) 评论(0) 推荐(0) 编辑
摘要: 题意:已知一个DNA串和一些病毒DNA序列,求出最少改变DNA串中多少个字符,能使得串中不包含任意一个病毒序列。题解:嗯,和上一个trie图一样,把病毒建成trie,只要母串不能再trie上走到危险节点即可(危险节点就是病毒dna序列的终止的那个被标有fg的节点)。然后trie图上的dp,要走到危险节点的时候,枚举转移即可。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <algo 阅读全文
posted @ 2013-03-05 21:24 proverbs 阅读(427) 评论(0) 推荐(0) 编辑
摘要: 多么明显的半平面交。答案一定在山的顶点处或者半平面交区域的顶点处。。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cstdio> 5 #include <algorithm> 6 7 #define N 555 8 #define EPS 1e-7 9 #define INF 1e12 10 11 using namespace std; 12 13 struct PO 14 { 15 double x,y; 阅读全文
posted @ 2013-03-05 21:20 proverbs 阅读(596) 评论(0) 推荐(0) 编辑
摘要: 题解:把原串直接接在后头,然后后缀数组本来就排序好了,正好用来求题目所需~毛线的,nlogn的就是烦,还是nlog^2n的好写,,View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <algorithm> 5 #include <cstdio> 6 7 #define N 220000 8 9 using namespace std;10 11 char s[N];12 int rank[N],sa[N];13 int 阅读全文
posted @ 2013-03-05 21:18 proverbs 阅读(946) 评论(0) 推荐(0) 编辑
摘要: 貌似是论问题?、、感觉挺好玩了,写起来也简单。。http://files.cnblogs.com/proverbs/Trie%E5%9B%BE%E7%9A%84%E6%9E%84%E5%BB%BA_%E6%B4%BB%E7%94%A8%E4%B8%8E%E6%94%B9%E8%BF%9B.pdfView Code 1 #include <cstring> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <iostream> 5 #include <algorithm> 6 7 # 阅读全文
posted @ 2013-03-05 21:15 proverbs 阅读(693) 评论(0) 推荐(0) 编辑
摘要: 题解:一开始想二分答案,发现不会验证。。然后果断看到题解说每一刀切在哪里是可以算的。。按照两边的分配的块数。。暴力就好~View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cstdio> 5 #include <algorithm> 6 7 #define INF 1e9 8 9 using namespace std;10 11 int n,m,gs;12 13 inline double dfs(double x 阅读全文
posted @ 2013-03-05 21:14 proverbs 阅读(892) 评论(0) 推荐(0) 编辑
摘要: 这题不能用普通的tarjan来缩点,因为看第一个样例普通tarjan会跪的很惨。。然后乱yy一个缩点就好了。桥边和环上的边分开处理,挺容易看懂的。。。神犇都说这题水,我这弱菜觉得一点都不水,,,View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdio> 4 #include <cstdlib> 5 #include <algorithm> 6 7 #define N 2222222 8 9 using namespace std;10 11 int 阅读全文
posted @ 2013-03-05 21:10 proverbs 阅读(1212) 评论(0) 推荐(0) 编辑
摘要: 题解:最小生成树的两个性质:1、边权相等的边的个数一定。2、做完边权为w的所有边时,图的连通性相同。然后就暴力dfs吧~View Code 1 #include <cstdio> 2 #include <iostream> 3 #include <algorithm> 4 #include <cstdlib> 5 #include <cstring> 6 7 #define N 2000 8 #define M 30000 9 #define mod 31011 10 11 using namespace std; 12 13 str 阅读全文
posted @ 2013-03-05 21:03 proverbs 阅读(944) 评论(0) 推荐(0) 编辑
摘要: 题解:dp[i][j]表示长度为i,匹配了j个的方案数,压缩成矩阵,转移即可。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cstdio> 5 #include <algorithm> 6 7 #define SIZE 21 8 9 using namespace std; 10 11 struct MT 12 { 13 int x,y; 14 int mt[SIZE][SIZE]; 15 void prt() 阅读全文
posted @ 2013-03-05 21:00 proverbs 阅读(1462) 评论(0) 推荐(0) 编辑