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 <int> Obj; | |
template <int T> 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 { |
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 <cstdio> | |
#include <cstring> | |
#include <cctype> | |
#include <cstdlib> | |
#include <cmath> | |
#include <ctime> | |
#include <iostream> | |
#include <map> | |
#include <set> | |
#include <list> |
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 <cstdio> | |
#include <cstring> | |
#include <iostream> | |
#include <sstream> | |
#include <algorithm> | |
#include <vector> | |
#include <set> | |
#include <map> | |
#include <bitset> | |
#include <string> |
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 <cstdio> | |
#include <cstring> | |
#include <iostream> | |
#include <sstream> | |
#include <algorithm> | |
#include <vector> | |
#include <set> | |
#include <map> | |
#include <bitset> | |
#include <string> |
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 <cstdio> | |
#include <cstring> | |
#include <iostream> | |
#include <sstream> | |
#include <algorithm> | |
#include <vector> | |
#include <set> | |
#include <map> | |
#include <bitset> | |
#include <string> |
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 <cstdio> | |
#include <cstring> | |
#include <iostream> | |
#include <sstream> | |
#include <algorithm> | |
#include <vector> | |
#include <set> | |
#include <map> | |
#include <bitset> | |
#include <string> |
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 <cstdio> | |
#include <cstring> | |
#include <cctype> | |
#include <cstdlib> | |
#include <cmath> | |
#include <ctime> | |
#include <iostream> | |
#include <map> | |
#include <set> | |
#include <list> |
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 <cmath> | |
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; |
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 <cstdio> | |
#include <cstring> | |
#include <cstdlib> | |
#include <set> | |
#include <map> | |
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
#include <bitset> | |
using namespace std; |
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 <cstdio> | |
#include <cstring> | |
#include <cmath> | |
#include <set> | |
#include <map> | |
#include <vector> | |
#include <iostream> | |
#include <algorithm> | |
using namespace std; | |
#define rep(i,n) for (int i = 0; i < (int)(n); i++) |
NewerOlder