摘要: 题意:分为两种点,求两种点之间的平面最近点对题解:分治法。这个怎么暴力分治都能过。。吐槽:我用了g++ tle+wa,毛线。。。View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <cstdio> 5 #include <algorithm> 6 #include <cmath> 7 8 #define N 222222 9 #define EPS 1e-710 #define INF 1e1511 12 阅读全文
posted @ 2013-02-23 22:32 proverbs 阅读(826) 评论(0) 推荐(0) 编辑
摘要: 题意:判断点在多边形内题解:随机一个区域外的点,与所有线段求交,如果点数为奇数,则在多边形内,反之,在多边形外需要注意:1、与多边形的顶点相交时,重新随机一个点2、点若在多边形上的话,直接返回奇数(我就在这里tle了。。一直随机,不停了。。。)View Code 1 #include <iostream> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <cstring> 5 #include <algorithm> 6 #include <cmath> 7 #inc 阅读全文
posted @ 2013-02-23 21:35 proverbs 阅读(237) 评论(0) 推荐(0) 编辑
摘要: 题意:给定半圆的圆心和半径和n个点,求能在半圆内的最多的点数。题解:先把所有的在圆外的点删除,然后求出所有的点关于圆心的极角,然后排序,因为是环形的,极角复制一份加在原来的后面,维护双指针即可~View Code 1 #include <iostream> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <cstring> 5 #include <algorithm> 6 #include <cmath> 7 8 #define PI 3.141592653589 9 阅读全文
posted @ 2013-02-23 21:31 proverbs 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 题意:求凸包周长题解:注意特判就好,两个点时特判,不知为什么。。View Code 1 #include <iostream> 2 #include <cstdio> 3 #include <cstdlib> 4 #include <cstring> 5 #include <algorithm> 6 #include <cmath> 7 8 #define N 120 9 10 using namespace std;11 12 struct PO13 {14 int x,y;15 }p[N];16 17 int stk[ 阅读全文
posted @ 2013-02-23 21:27 proverbs 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 题意:是否存在规范相交View Code 1 #include <iostream> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <cstring> 5 #include <algorithm> 6 #include <cmath> 7 8 #define N 2020 9 #define EPS 1e-410 //规范相交 11 using namespace std;12 13 struct PO14 {15 double x,y;16 };17 18 str 阅读全文
posted @ 2013-02-23 21:25 proverbs 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 题意:很多线段,求总交点个数(不规范相交),没有三线共点题解:模板,拿几道计算几何水题开头,准备计算几何专题了~这个题的细节其实很多,只是数据太水了!不规范相交模板:View Code 1 #include <iostream> 2 #include <cstdlib> 3 #include <cstdio> 4 #include <cstring> 5 #include <algorithm> 6 #include <cmath> 7 8 #define N 110 9 #define EPS 1e-7 10 #defi 阅读全文
posted @ 2013-02-23 21:24 proverbs 阅读(639) 评论(0) 推荐(0) 编辑
摘要: 题解:每个数第一次出现时随便改成pos-n,之后改成前一次出现的位置。询问的时候查找一个区间中比左端点小的数的个数吐槽:尼玛数组越界了查了一晚上+半个下午。树套树这种东西真难查错!我多插入了很多没有用的节点,所以就慢了点,不过省代码~View Code 1 #include <iostream> 2 #include <cstring> 3 #include <cstdlib> 4 #include <algorithm> 5 #include <cstdio> 6 7 #define N 6000050 8 #define INF 阅读全文
posted @ 2013-02-23 10:15 proverbs 阅读(1106) 评论(0) 推荐(0) 编辑