mcfx's blog - kdtree
/category/kd/
-
BZOJ 1176&2683&4066
/archives/97/
2016-12-11T14:51:00+08:00
[传送门][1] [传送门][2] [传送门][3]
题目大意:单点加,矩阵查询
直接上kdtree就好了,定期暴力重构
1176题代码:
```c++
#include
typedef unsigned char uchar;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
#define xx first
#define yy second
template inline T max(T a,T b){return a>b?a:b;}
template inline T min(T a,T b){return a0?a:-a;}
template inline void repr(T &a,T b){if(ab)a=b;}
template T gcd(T a,T b){if(b)return gcd(b,a%b);return a;}
template T sqr(T x){return x*x;}
#define mp(a,b) std::make_pair(a,b)
#define pb push_back
#define lb(x) ((x)&(-(x)))
namespace kd
{
const int D=2,inf=1000000000;
char dnow;
struct point
{
int d[D],val;
int operator[](int x){return d[x];}
};
inline bool operator