Instantly share code, notes, and snippets.

# edwardmjm

• London
Created April 20, 2014 16:22
KDTree 通用模板
View gist:11118130
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 /* 使用前调用init静态建树，然后模仿query进行类Binary Search Tree式的访问即可 Obj是点的类型，如果追求效率或者在点上除了坐标还有其它信息，可以自己写一个Obj类，然后重载[]运算符 */ namespace KDTree { int K; typedef vector Obj; template bool cmpT(const Obj &a, const Obj &b) { return a[T] < b[T]; } bool (*cmp[])(const Obj &, const Obj &) = {cmpT <0>, cmpT <1>, cmpT <2>}; //填到所需要的最大维度数目为止，这里表示的是最大3维 struct Filter {
Created January 22, 2014 15:12
View gist:8560374
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include const int MAXN = 100; const double EPS = 1e-10; //列主元gauss消去求解a[][]x[]=b[] //返回是否有唯一解,若有解在b[]中 bool gaussCpivot(int n, double a[][MAXN], double b[]) { int i, j, k, row; double maxp, t;
Created December 14, 2013 23:57
View gist:7966694
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #include #include #include #include #include #include #include using namespace std;
Created October 3, 2013 15:56
View gist:6812193
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #include #include #include #include #include #include using namespace std; #define rep(i,n) for (int i = 0; i < (int)(n); i++)
Created March 30, 2013 15:02
topcoder template
View gist:5277009
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #include #include #include #include #include #include #include #include
Last active December 15, 2015 12:39
View gist:5261885
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #include #include #include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define foreach(it, v) for (typeof((v).end()) it = (v).begin(); it != (v).end(); it++) const int MAX_N = 100005; struct Node {
Created February 1, 2013 10:53
View gist:4690632
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #include #include #include #include #include #include #include #include
Created January 30, 2013 09:17
neerc I
View gist:4671872
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #include #include #include #include #include #include #include #include
Created January 26, 2013 14:11
View gist:4642582
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #include #include #include #include #include #include #include #include
Created January 24, 2013 18:33
icpcarchive6041
View gist:4626176
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #include #include #include #include #include #include #include #include #include using namespace std;